- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 10:14 AM - edited 11-08-2022 10:15 AM
Hi Everyone!
I've written a UI Action that clears a couple of fields, resets a dropdown menu, and triggers a notification when a custom button is clicked. The trouble is that the function never executes the gs.eventQueue -- it hangs on that line of code -- and doesn't finish the remaining tasks. The notification doesn't go out, either.
I've tried everything I can think of to make this work, including double, tripled, a thousand times checking that the name of the Event Registry that I'm calling is an exact match (trust me, it is) but, still, it won't execute or move beyond that line.
Any ideas that you might have would be greatly appreciated.
Thanks!!
function projectDeclined()
{
//A confirm dialog box to verify the producer's choice
var projectAssignmentDeclined = confirm("Please note: declining this project will result in it being assigned to another producer.");
//If the producer accepts the condition to decline...
if(projectAssignmentDeclined)
{
//Sets the value of Producer to blank
g_form.setValue("u_producer", "");
//Sets the value of Producer's email to blank
g_form.setValue("u_producer_email", "");
//Sets the value Project Status to Assignment
g_form.setValue("u_project_status", "assignment");
//Creates an event to initiate a notification
gs.eventQueue("x_snc_vpm_2.producer_declined", current);
//Submits the form
g_form.submit();
//Redirect the user to My Projects dashboard
action.setRedirectURL(current);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 10:17 AM - edited 11-08-2022 10:18 AM
Looks like this is all client side code, which means gs.eventQueue will not work. gs.eventQueue only works in server side code.
Here is an example of how to call client and server in one UI action
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0657198
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 10:17 AM - edited 11-08-2022 10:18 AM
Looks like this is all client side code, which means gs.eventQueue will not work. gs.eventQueue only works in server side code.
Here is an example of how to call client and server in one UI action
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0657198