Business duration left on Incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi all,
I have created a new field named as business time left and Wrote a business rule on incident table to query the related task sla record and copy the same value and gets pasted there. now the field is not populated. I am pasting my script below.
My requirement is when the business time left in task sla changes, The field on the incident form should also reflect same.
It is an ASYNC business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
you should have after update BR on task_sla with condition as Business time left Changes
(function executeRule(current, previous /*null when async*/ ) {
// Ensure we are only targeting incidents
if (current.task.sys_class_name == 'incident') {
var incidentGR = new GlideRecord('incident');
if (incidentGR.get(current.task)) {
// Copy the business time left value from task_sla to the incident
incidentGR.u_business_time_left.setDateNumericValue(current.business_time_left.dateNumericValue());
incidentGR.update();
}
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
43m ago - last edited 43m ago
Hi @Abishek1998
What type of Field business time left is?
In this line parse the value properly , it will be set .
current.u_business_time_left = slaGR.getValue('business_time_left');
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti