- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 07:43 AM
1) I have created reference field in incident table.
name- u_business_duration
referencing task_sla table
2) created BR on task_sla table with when-after insert , update (also tried before-after update)
script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord('incident');
inc.get(current.task);
inc.u_business_duration = current.business_duration;
inc.update();
})(current, previous);
but it is still not working 😞 can anyone help?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2022 12:21 PM
Hi, Can you try changing the "Type" of that field on incident table to "Duration".
On "task_sla" table the type of "Business elapsed time" is "Duration" and on incident table, you have created field of type "Reference".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 07:45 AM
@Ankur Bawiskar - can you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 07:53 AM
add "gs.info("Found incident " + inc.number + " for current.task = " + current.task);" just after the line 'inc.get(current.task);' And see if you get a valid result. Is 'current.task' a sys_id?
You can see the results of the gs.info() in the 'Script Log Statements' module.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2022 08:37 AM
Hi, I've changed the BR "when" condition to: before, now I'm getting the correct sys id in logs but still business duration is not visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2022 12:21 PM
Hi, Can you try changing the "Type" of that field on incident table to "Duration".
On "task_sla" table the type of "Business elapsed time" is "Duration" and on incident table, you have created field of type "Reference".