- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2023 12:08 PM
I am trying to use a scheduled job to add an additional comment to RITM that meet a certain query. I want RITM that have the state open, approval requested, and created date more than 6 and less than 9 days from the query. Here is the code I came up with, but it isn't making any additional comments.
var gr = new GlideRecord('sc_req_item');
gr.addQuery('state', 'open');
gr.query();
while (gr.next()) {
var comment = 'New comment here?';
gr.work_notes = comment + '\n\n' + gr.work_notes.getJournalEntry(1);
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 01:48 PM
Had a lot of issues with the scheduled job. One being testing was hard since it had to query soooo many records it actually slowed down the whole instance for a whole afternoon of testing. Ended up making it work with a flow. Trigger was when a request was made we did a wait for duration and then looked up the ritm table for those created relative to before 5 days ago and after 7 days ago then updated the record with the additional comment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 01:48 PM
Had a lot of issues with the scheduled job. One being testing was hard since it had to query soooo many records it actually slowed down the whole instance for a whole afternoon of testing. Ended up making it work with a flow. Trigger was when a request was made we did a wait for duration and then looked up the ritm table for those created relative to before 5 days ago and after 7 days ago then updated the record with the additional comment.