Script needed to update resolved_at in incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 08:21 AM
Can you tell me script or any method to upsdate resolved_at in incident
currently incident in closed state

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 08:30 AM
Hi Sai,
Did you try using background script? Additionally, if you use Windows you can press Ctrl + Shift + Alt + J and then set the value client side using g_form.setValue('resolved_at','datetime you want to pass'); & then save the record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 08:32 AM - edited 08-28-2023 08:33 AM
@Saib1 Here is the script which you can run in your background script.
var glideRecord = new GlideRecord('incident');
if(glideRecord.get('f12ca184735123002728660c4cf6a7ef')){//Replace with you incident sys_id
glideRecord.setValue('resolved_at','2023-07-04 14:39:39');
glideRecord.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 08:43 AM
Hi there,
Before sharing any script, it would be better to understand your situation.
Is this just a one-time fix? On a single record? On multiple records? Or do you want to perform this more often, or perhaps even scheduled? Or should by default already the resolved_at get a different behavior than you are experiencing now?
Please clarify your situation so we can help you better.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field