Alternate solution for current.sys_id in Scheduled job run script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 12:56 AM - edited 12-07-2022 02:35 AM
Hi All,
The below code is working in BR but not in a scheduled job so what is the best way to replace gr.addQuery('sys_id', current.sys_id); in a scheduled job run script?
var gr = new GlideRecord('u_custom_integration');
gr.addQuery('sys_id', current.sys_id);//not considering in scheduled job run script
gr.setLimit(1);
gr.query();
if (gr.next()) {
//tried gr.addQuery('sys_id', getUniqueValue()); but not working
@Ankur Bawiskar Any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 02:34 AM - edited 12-07-2022 02:34 AM
gr.addQuery('sys_id', getUniqueValue()); //tried not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 03:00 AM
what's your business requirement?
you need to know which record should be queried with proper query conditions
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 04:51 AM
the requirement is very difficult to explain actually I just wanted to know how we can replace the gr.addQuery('sys_id', current.sys_id); in scheduled job run script as in br its works and gives the current record sys id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 05:15 AM
without knowing the requirement cannot help much
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 05:27 AM
I have created an integration to crate Ritms through API and once the Ritm created through the BR I am sending back the ritm no and a few other details to u_custom_integration through the same BR. for sending that I used the below query but its not working on the scheduled job, basically this scheduled job script is similar to BR and its for triggering when the BR not run
var gr = new GlideRecord('u_custom_integration');
gr.addQuery('sys_id', current.sys_id);//not considering in scheduled job run script
gr.setLimit(1);
gr.query();
if (gr.next()) {