Triggering event from script include

pradeepgupta
Giga Expert

Hi All,

Can we trigger event from script include as follows:

gs.eventQueue("sla.user.triggerEmail",);

Actually I have written one function in script include which contains gs.eventQueue(); , this function is called to trigger the event which results in triggering email notification.

Is it valid to use gs.eventQueue() in script include?

17 REPLIES 17

I think you have to pass the parameters for it to work.



Events and Email Notification - ServiceNow Wiki


Mike Allen I don't want to pass any parameter, just want to trigger event, rest of the things will be done by notification which will triggered based on event.




Harish Murikinati I not making glide query in the function, so how can i pass glide object, any other alternative.




with gs.eventQueue("sla.user.triggerEmail"); I am not able to get the event in logs.


Then maybe you can do:



gs.eventQueue("sla.user.triggerEmail", current, null, null);




or something like that?


Create script include in global, make it accessible form all scopes:

var myGlobalFunctions = Class.create();
myGlobalFunctions .prototype = {
    initialize: function() {
    },
	globalEventQueue: function(event,gr,param1,param2){
		gs.eventQueue(event,gr,param1,param2);
	},
	
    type: 'myGlobalFunctions '
};

Then you can call it from your scope like this:

new global.myGlobalFunctions().globalEventQueue("myevent",my_gr,myParam1,myParam2);

Harish Murikina
Tera Guru

if your not passing parameters means who will receive the email ? Are you hard coding the email?