Set Automatically Incident state to In-progress from on-hold when "OnHold until" Date field was hit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 07:46 AM
Hi All,
We have a requirement, Once the "On hold until date" field was hit, the Incident would automatically go back into 'in progress' state.
created a Scheduled Job for this requirement but it is not working. please help me on this
Custom field type Date and Time "NowDateTime" and field value is 'u_nowdatetime' it is storing the current date/time. so that added if condition in above code with 'NowDateTime' field.
could you please help me on this requirement.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 05:03 AM
Hi @Suresh_32 ,
you can update your script as below.
this script will run daily at time 00:00:01
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state=3^u_on_hold_until_dateISNOTEMPTY');
gr.query();
while (gr.next()) {
var time = new GlideDateTime(gr.u_on_hold_until_date);
var td = new GlideDateTime();
if (td >= time) {
gr.state = '2';
gr.update();
}
}
If my response is useful please mark helpful or accept as a solution.
Thanks