How to show Business elapsed time in incident table report?

Query1
Tera Contributor

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?

1 ACCEPTED SOLUTION

anirudhpathak
Tera Expert

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".

View solution in original post

4 REPLIES 4

Query1
Tera Contributor

@Ankur Bawiskar - can you please help?

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.

Query1
Tera Contributor

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.

anirudhpathak
Tera Expert

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".