diff --git a/Client-Side Components/UI Pages/Send Email On Form Incident/EmailScript.js b/Client-Side Components/UI Pages/Send Email On Form Incident/EmailScript.js new file mode 100644 index 0000000000..7890cfcd32 --- /dev/null +++ b/Client-Side Components/UI Pages/Send Email On Form Incident/EmailScript.js @@ -0,0 +1,19 @@ +// Email is been used to set the cc and subjed where we got from the UI Page and this will be attached to the Notification to run dymanically + + +(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template, + /* Optional EmailOutbound */ + email, /* Optional GlideRecord */ email_action, + /* Optional GlideRecord */ + event) { + + + // In this we get the data in the 4th parameter so that we use the parm2 to get the object of data and the used in the certain purpose + + var obj = JSON.parse(event.parm2); + email.addAddress("cc", obj.cc); + email.setSubject(obj.subject); + + template.print("
Details are :
" + obj.body); + +})(current, template, email, email_action, event); \ No newline at end of file diff --git a/Client-Side Components/UI Pages/Send Email On Form Incident/Notification.js b/Client-Side Components/UI Pages/Send Email On Form Incident/Notification.js new file mode 100644 index 0000000000..ac5b15c10b --- /dev/null +++ b/Client-Side Components/UI Pages/Send Email On Form Incident/Notification.js @@ -0,0 +1,22 @@ +/* +Notificaiton for this proble + +Table : Incident (incident) + +When to Send +Send when - Event is fried +Event name - SendEamilInForm + +Who will receive +Event parm 1 contains recipient - True + +What it will contain +// This will hold the email script which we use to populate the subjec and the body. +Message HTML - ${mail_script:IncidentFormScript} +Email template - Unsubscribe and Preferences +Content type - HTML only + +*/ + +// Name of the Email Script will be populated when the notification has been triggered. +${mail_script:IncidentFormScript} \ No newline at end of file diff --git a/Client-Side Components/UI Pages/Send Email On Form Incident/Readme.md b/Client-Side Components/UI Pages/Send Email On Form Incident/Readme.md new file mode 100644 index 0000000000..78dfaffa32 --- /dev/null +++ b/Client-Side Components/UI Pages/Send Email On Form Incident/Readme.md @@ -0,0 +1,39 @@ +Send Email On Form for every Record + +Script Type: UI Action, Table: incident, Form button: True, Client: True, Show update: True, OnClick: functionName() + +Script Type: UI Page Category: General + +Script Type: Email Script + +Event Registry : Table: incident, Fired by: UI Page, Event Name: SendEmailInForm + +Notification : Table: incident, Type: EMAIL, Category: Uncategorized, + +Goal: To Send Email on Form Directly by population some field and then customize the body and trigger it. + +Walk through of code: So to send the Email directly on each and every record there will be a UI Action which will help to populate the UI Page which we use some field to be populate in the UI Page directly to the particulat HTML content and these are the fields will be populate (Caller Email as the To and then Short Description as the Subjet of the Email) and othe field will be CC and Body which the user want to decide what data can be filled out and then send. + +