- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2018 11:42 PM
Dear all,
I could not find the steps to trigger an event using ScheduleJob.
Could anyone point me out steps by step
regards
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 07:27 AM
As per the documentation, the gr is a glide record object. To be honest i'm not 100% sure on its purpose or function in this context.
It's not something you can use and reference in your mail script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 12:44 AM
The schedule Job is sending email every 5 minutes but ONLY for records where myFlag=true.
If there is no record with myFlag=true, the the event should not fired when schedule reach 5 minutes
regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 01:28 AM
Then the skeleton code:
Gliderecord object initialization with the proper query
{
gs.eventQueue('event name',gliderecord object,'recipient-list');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 01:51 AM
what is recipient-lis in your sample ?
here are the scheduleJob script I have implemented :
//Build record object on asset table
var gr = new GlideRecord('alm_asset');
//Append the querry to generate the view record based on condition
gr.addEncodedQuery('u_send_record_to_mail=true');
gr.query();
//If tehre is at least one records, we fire the event
while (gr.next()) {
gs.addInfoMessage("Event fired");
gs.eventQueue("Asset.retired.ccchange", gr);
//we reset the flag in order to avoid unneeded resend
gr.u_send_record_to_mail = false;
gr.update();
}
But issue i get in my script above is that I need to set the u_send_record_to_mail=false for all return records after event is fired, how can do that ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 02:01 AM
What you have above seems the code that will reset the flag. The recipient is the list of people you want to send the email. If you have the recipient on the notification, then you can ignore this