We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Send notification using Schedule Job.

itsangeleye
Giga Contributor

How can we generate a notification for the manager of the 'Requested For' user when a Requested Item (RITM) for a specific catalog item has a start date between 5 to 6 days ago?

1 ACCEPTED SOLUTION

Rushi Savarkar
Mega Sage

Hello @itsangeleye 

Please find below code and let me know if that works for you

Schedule job:

var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', '620c2fb4c39b5a1004c43132b40131d1'); // replace your catalog item sys_id
gr.addQuery("variables.effe2774c35f5a1004c43132b4013141", "<=", gs.daysAgo(5)); //replace your start date variable sys_id
gr.query();
gs.info(gr.getRowCount());
while (gr.next()) {
gs.eventQueue('send.notification.demo', gr, gr.variables.manager, ''); // Event should be created
}

Thank you!

If my response helped you, please accept the solution and mark it as helpful.
Thank You!

View solution in original post

5 REPLIES 5

glideFather
Tera Patron

@itsangeleye 
You can create a flow and set it accordingly.
Or a workflow, depending what is in use for your instance

Let me know how you progress and if you need to consult some steps


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---