- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 07:08 AM
I need current date/time on sc task r(esolved field) when state ritm state changes to resolved
I tried using br but didn't work.Please help me in this.
var gr2 = new GlideRecord('sc_task');
var gdt = new GlideDateTime();
current.u_resolved_time = gdt;
gdt.addDays(2);
gr2.update();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 07:42 AM
Hi,
your BR would be after update on RITM
State [Changes to] Resolved
Script:
var gdt = new GlideDateTime();
var taskRec = new GlideRecord('sc_task');
taskRec.addQuery("request_item", current.getUniqueValue());
taskRec.query();
while(taskRec.next()){
taskRec.setValue("u_resolved_time", gdt);
taskRec.update();
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 07:26 AM
Write after BR on the RITM table
Use below script:
var gdt = new GlideDateTime();
var resolvedDate = gdt.addDays(2);
var gr2 = new GlideRecord('sc_task');
gr2.addQuery("request_item", current.getUniqueValue());
gr2.query();
While(
gr2.setValue("u_resolved_time", resolvedDate);
gr2.update();
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions š
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 07:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 09:41 PM
The BR should be after update and not insert, because you want to run the BR whenever there is a update on RITM form.
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions š
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 07:42 AM
Hi,
your BR would be after update on RITM
State [Changes to] Resolved
Script:
var gdt = new GlideDateTime();
var taskRec = new GlideRecord('sc_task');
taskRec.addQuery("request_item", current.getUniqueValue());
taskRec.query();
while(taskRec.next()){
taskRec.setValue("u_resolved_time", gdt);
taskRec.update();
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader