- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2020 05:10 AM
Hello,
I have a catalog client script that triggers an event and passes a parameter ('Email address' field) based on conditions when the catalog record producer is submitted. It does not seem to be working, is my code wrong?
Catalog client script
function onSubmit() {
if (g_form.getValue(custom)=='yes'){
gr.eventQueue("x_utsll_candidate.canOutCustom",email_address);
}
else{
gr.eventQueue("x_utsll_candidate.canOut",email_address);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2020 05:19 AM
Hi there,
gr.eventQueue will not work. gr is nothing in this script? Looks a bit like you might copied this from a server side script? Or typo, as I normally use this in server side script as gs.eventQueue. Also getValue(custom) > custom is missing quotes.
Without knowing your requirement:
You could already - because it's record producer - do gs.eventQueue within the script field of the record producer instead of onSubmit client script. The if statement just a little bit diffent, like if(current.variables.custom == "Yes") {
Can you functionally describe what you are trying to achieve and maybe why choosing client scripting?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2020 05:19 AM
Hi there,
gr.eventQueue will not work. gr is nothing in this script? Looks a bit like you might copied this from a server side script? Or typo, as I normally use this in server side script as gs.eventQueue. Also getValue(custom) > custom is missing quotes.
Without knowing your requirement:
You could already - because it's record producer - do gs.eventQueue within the script field of the record producer instead of onSubmit client script. The if statement just a little bit diffent, like if(current.variables.custom == "Yes") {
Can you functionally describe what you are trying to achieve and maybe why choosing client scripting?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2020 05:23 AM
Hi ,
I think you need to use client script and script includes in this scenario.Pass the sys_id of the catalog record from client side to the the script include(server side) write a GlideRecord to that table and get the record using sys_id and pass gr object as the second parameter and trigger event there.
Please mark it as helpful (or) correct if it helps.
Thanks,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2020 05:41 AM
Hi,
Check this link,It will help you.
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2020 07:44 AM
Any luck on this? Did you try adding the code to for example the Script field of the Record Producer?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field