Can we trigger email notification using client script?

DS14
Tera Contributor

Can we trigger email notification using client script?

5 REPLIES 5

Venkateswarlu K
Mega Guru

Hi Deepali


I think client script only not possible instead of client script better to use the Glide AJAX mention gs.eventQueue(); in script include this will trigger the email notification


Kalaiarasan Pus
Giga Sage

Create a script include with a function that triggers events using gs.eventQueue.


Call the script include using GlideAjax.


Mihir Mohanta
Kilo Sage

You will get some examples of GlideAjax here



GlideAjax - ServiceNow Wiki


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Deepali,



You can't trigger email notification from client side scripts.


When you want the email to trigger?   if it is onChange of some field then whenever you will write onChange client script on that field you will have to do GlideAjax and in the Script Include function use gs.eventQueue() method and pass necessary parameters.


As best practice have your GlideAjax as Asynchronous so that browser won't wait till the script include function returns something and email will get triggered in backend.



GlideAjax - ServiceNow Wiki


Examples of asynchronous GlideAjax


Events and Email Notification - ServiceNow Wiki



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader