Event Queue Schedule

SireeshaKoppise
Giga Contributor

Hi ,

I need to trigger an event based on schedule (schedule is being defined in the 'cmn_schedule').  Can i pass the schedule name or schedule sys_id in gs.eventQueueScheduled()?

Else please provide the suggestion for scheduling an eventQueue.

Regards,

Siri

4 REPLIES 4

Alikutty A
Tera Sage

Hello,

You can only pass a date time as the 5th parameter in eventQueueScheduled() and it will execute the event at the specific time. You could write a schedule job and setup the required schedule in it. Refer to this link  below

Using the schedule 8-5 weekdays

 

SireeshaKoppise
Giga Contributor

Hi,

The event should be triggered based on record update and i can't do it through scheduled jobs. The event should be triggered only during Business hours. So, is there a way to pass Schedule as last parameter for eventScheduled() function?

 

 

No schedule cannot be added in gs.eventScheduled()

If it based on record update, then you need to calculate if your schedule is within current update date time in a business rule. If yes you should trigger your event.

var schedule = new GlideSchedule("090eecae0a0a0b260077e1dfa71da828");   //replace sys_id with the id of schedule

if(schedule.isInSchedule(new GlideDateTime(gs.nowDateTime()))){

gs.eventQueue("event_name", current, '', '');

}

 

Hello,

Is this answered? Do you have any other queries. If your query is resolved, please do mark the correct answer and close the thread