get date/time when state = resolved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 11:09 AM
When the state = resolved i have a business rule that is running and setting the resolved by field to the user. I need it to also get the date and time when it was resolved. Then after it gets the date i need to set the field "closed" to 2 days after the state = resolved. Any ideas on how to do this?
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 11:18 AM
You have a system property to autoclose resolved incidents.
Check below:
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 11:19 AM
Hi, you should be able to use the dateTime functions - something like
var myTime = new GlideTime();
gs.info("Current system Time " + myTime);
myTime.addDaysLocalTime(2);
gs.info("updated time " + myTime);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 11:32 AM
Hi tyler ,
Create "custom field" on your table and create before business rule on that table with condition state is resolved.And populate "sys_updated_on" value into "custom field".
Then after create a scheduled job with condition resolved relatively 2 days ago and run the scheduled job periodically to update the state to closed complete.
Please mark it as helpful (or) correct if it helps.
Thanks,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 11:35 AM
Hi,
In the existing Br, add this code.
//When the state = resolved i have a business rule that is running and setting the resolved by field to the user. I need it to also get the date and time when it was resolved. Then after it gets the date i need to set the field "closed" to 2 days after the state = resolved. Any ideas on how to do this?
var gdt = new GlideDateTime();
current.u_resolved_time=gdt;//this field u_resolved_time will store the resovled date and time. create this field of type date/time.
gdt.addDays(2);
current.u_closed=gdt;//this field u_closed will store the closed date.
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP