- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:05 AM
I want to change regularly all "on Hold" Incidents and where the "follow up" fields are exceeded that the field values of "follow up" are cleared and the "State" changes to "in Progress"
Also I want to fill in a Work Note saying "The Incident changed to "in Progress" because the "Follow Up" is exceeded.
I´m a rookie with this platform and I´m overwhelmed by the possibilities of this platform 🙂
I´m very thankful in advance 🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:17 AM
You can run a scheduled job daily (or as per your convenience) for this with below code:
var inc = new GlideRecord('incident');
inc.addEncodedQuery('state=3^follow_up<javascript:gs.beginningOfToday()'); // will fetch on hold incident with follow up date before today, so when it will run daily, all incidents will be covered.
inc.query();
while(inc.next())
{
inc.state=2;
inc.update();
}
Note: All scripts should be tested in dev before execution in prod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:29 AM - edited 12-19-2022 03:29 AM
Scheduled job, which will run daily. (sysauto) table.
For more info refer : https://docs.servicenow.com/en-US/bundle/tokyo-platform-administration/page/administer/reference-pag...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 06:46 PM
When i am running the schedule job for every 5 mints its not working for me and state of the incident is not changing to in progress . Please find the attached screen shots along with logs . Please let me know if anything has to be modified in the script
Script :
