- 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.
Raghav
MVP 2023
- 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...
Raghav
MVP 2023
- 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.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:22 AM - edited 12-19-2022 03:26 AM
For my understanding. Do I write this in a Client Script or a UI Policy?
- 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...
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 07:36 AM
@Steve2000 if your issue is fixed, do mark the relevant answer correct to close the thread.
Raghav
MVP 2023