- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2018 03:07 PM
So I have a task form on which there is checkbox or a true/false field. I want to send the description text to an email address when the record is updated and the checkbox is selected. I have registered an event and created a notification as well however I can't use eventQueue method in a Catalog Client Script due to below error:
I have tried to put the event in eventQueue using business rule as well but I can't check if the checkbox is selected or not because business rule is not allowing me to use g_form:
Could someone please take a look at it and tell me if this is even doable or not? If yes, how can I implement it.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2018 03:14 PM
Hi Sagar,
If you are doing this for a catalog item then you can Create a Catalog Client Script and fire the Event by making a GlideAjax Call. Please refer below link for more info on GlideAjax.
https://community.servicenow.com/community?id=community_blog&sys_id=f8ccee25dbd0dbc01dcaf3231f961978
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference/r_ExamplesOfAsynchronousGlideAjax.html
Thanks,
Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2018 03:14 PM
Hi Sagar,
If you are doing this for a catalog item then you can Create a Catalog Client Script and fire the Event by making a GlideAjax Call. Please refer below link for more info on GlideAjax.
https://community.servicenow.com/community?id=community_blog&sys_id=f8ccee25dbd0dbc01dcaf3231f961978
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference/r_ExamplesOfAsynchronousGlideAjax.html
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2018 03:28 PM
gs (Glide Systems) is a Server Side entity. You cannot use it in Client Scripts.
g_form is a Client Side Entity. You cannot use it in Server Side Scripts(Business Rules, Script Includes etc etc).
I see that you are checking if the value is true for a field and then trying to fire the event from the onSubmit Client Script.
I suggest you, to create a Business Rule and set the conditions in the Conditions(When to run) part. and in the script use your gs.eventQueue line in the script part.
OR
As Pradeep Sharma suggested, You need to use Glide Ajax in the Client script and Fire the event from the script include.
-Aman Gurram
CCS UTTyler(2016-2017)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2018 12:32 PM
Hi Sagar,
As suggested by the other two, GlideAjax helps you in achieving this.The below one may help you.
onSubmit client script:
var ga = new GlideAjax('checkFlag');
ga.addParam('sysparm_name','checkFunc');
ga.addParam('sysparm_recid',g_form.getUniqueValue());
ga.getXML(callBack);
function callBack(response)
{
var answer = response.responseXML.documentElement.getAttribute("answer");
}
Script Include:
checkFunc: function()
{
var gr = new GlideRecord('table_name'); //Give the table name
gr.get(this.getParameter('sysparm_recid');
if(gr.email_CSFunctional)
{
gs.eventQueue('your_event_name',gr,gr.number,gs.getUserName()); Give your event name
}
},
//Make sure the name of Script Include is checkFlag
//Client callable must be true
Hope this helps!!
Thanks,
Archana