My gs.eventQueue is working

alexpullos
ServiceNow Employee
ServiceNow Employee

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);
	}
}
1 ACCEPTED SOLUTION

Mike_R
Kilo Patron
Kilo Patron

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

View solution in original post

1 REPLY 1

Mike_R
Kilo Patron
Kilo Patron

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