From d0d0e923b921532c77ff1d3ee7154c68310795ff Mon Sep 17 00:00:00 2001 From: Kart-19 <92006241+Kart-19@users.noreply.github.com> Date: Mon, 27 Oct 2025 20:52:47 +0530 Subject: [PATCH 1/2] Add files via upload Send Email On Form for every Record --- .../EmailScript.js | 19 +++ .../Notification.js | 22 ++++ .../Send Email On Form Incident/UIAction.js | 18 +++ .../UIPage_Html.html | 109 ++++++++++++++++++ .../UIPage_ProcessingScript.js | 13 +++ 5 files changed, 181 insertions(+) create mode 100644 Client-Side Components/UI Pages/Send Email On Form Incident/EmailScript.js create mode 100644 Client-Side Components/UI Pages/Send Email On Form Incident/Notification.js create mode 100644 Client-Side Components/UI Pages/Send Email On Form Incident/UIAction.js create mode 100644 Client-Side Components/UI Pages/Send Email On Form Incident/UIPage_Html.html create mode 100644 Client-Side Components/UI Pages/Send Email On Form Incident/UIPage_ProcessingScript.js 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/UIAction.js b/Client-Side Components/UI Pages/Send Email On Form Incident/UIAction.js new file mode 100644 index 0000000000..709e766e23 --- /dev/null +++ b/Client-Side Components/UI Pages/Send Email On Form Incident/UIAction.js @@ -0,0 +1,18 @@ +// This function will creat the model object and then route to the UI page which we configured to show the field details to fill by the user + +/* +Table- Incident (incident) +Form button - True +Client -True +Show Update - True +Onclick - Function name (sendEmail) + + + +*/ + function sendEmail(){ + var modalT = new GlideModal("SendEmailEvent", false, 1200); + modalT.setTitle("Send Email"); + modalT.setPreference("sysparm_sys_id", g_form.getUniqueValue()); + modalT.render(); + } \ No newline at end of file diff --git a/Client-Side Components/UI Pages/Send Email On Form Incident/UIPage_Html.html b/Client-Side Components/UI Pages/Send Email On Form Incident/UIPage_Html.html new file mode 100644 index 0000000000..2d47ac6adc --- /dev/null +++ b/Client-Side Components/UI Pages/Send Email On Form Incident/UIPage_Html.html @@ -0,0 +1,109 @@ + +