Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to delay the event in ServiceNow

Shantharao
Kilo Sage

Hi All,
How to delay the event in ServiceNow
I have identified gs.sleep() method but my lead is not interested use this function
I have used gs.eventQueueScheduled("event_name",current,'','',time);
This is not working as expected, 
Am I doing any mistake
I want to add one minute to the event queue processing time
Once the Event is created it should be processed after one minute

Thanks
 

2 REPLIES 2

J Siva
Kilo Patron
Kilo Patron

Hi @Shantharao 

May i know what value you are passing as "time"?
The last parameter should be date/time type object.

var gdt = new GlideDateTime();// get current time

gdt.addSeconds(60);

gs.eventQueueScheduled('<event_name>', current, '', '', gdt);

 

Regards,
Siva

Chaitanya ILCR
Mega Patron

Hi @Shantharao ,

 

https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/c_GlideSystemScoped...

you have to pass  GlideDateTime object as a parameter

 

expirationObjectOptional. GlideDateTime object or a date/time type element that specifies the date and time to process the event.

Default: Current date/time

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya