Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to calculate the Business Duration on RITM ?

raj99918
Tera Contributor

Hi,

 

How to calculate the Business Duration on RITM for newly created requests and also for Old records as well I have written the BR simlilar to mark_closed OOB BR but it's giving the wrong value below is my script

 

When to run: before (insert or update) and order 100.

 

Condition -- State is one of Closed Complete, Closed Incomplete and Closed Skipped.

 

Script:

 

(function executeRule(current, previous /*null when async*/ ) {

        var opened = current.opened_at.getValue();
        var closed = current.closed_at.getValue();

        if (current.business_duration.nil())
            current.business_duration = gs.calDateDiff(opened, closed, false); // Business Duration

        if (current.calendar_duration.nil())
            current.calendar_duration = gs.dateDiff(opened, closed, false); // Duration


    }


)(current, previous);
2 REPLIES 2

raj99918
Tera Contributor

hI @Ankur Bawiskar  Could you please help me in this issue ?

 

Thanks

damodharan1
Tera Contributor

Hello All,
   Any solutions found for this issue? i'm also facing same issue in our instance.

Thanks,