New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
201 views

I get errors in a JS RuleSet.

Jump to solution

I'm trying to calculate the outage duration using downtime.end - downtime.start but my issue is knowing how to do this in a JavaScript Rule in Process Designer.

The 1st line causes error: Count not process script    and    SyntaxError: missing ; before statement
The 2nd & 3rd lines do not calculate a duration.

Code:

If ( !system.functions._null(record.downtime_start)  && !system.functions._null(record.downtime_end ) )   {
  var oDur = record.downtime_end.getTime()  - record.downtime_start.getTime() ;
  record.o_downtime_duration = new Date( oDur );
 }

Any help would be appreciated.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Fleet Admiral
Fleet Admiral

Whenever I need to calculate outages, I use the snippet mentioned in this thread (3rd post): It's basically a wrapper to RAD application calendar.calc.interval.fc.

It seems to be written for SLA purposes - if the outage was within service hours - but if that's not in your plans, you can use the 24x7 work schedule as a schedule reference, so no reductions to the outage time will be made.

Maybe you don't need the all the functionality it offers, but it's a good all-around solution.

/t5/Service-Manager-Service-Center/SLO-duration-type-Calculation-End-of-the-month/m-p/4787115#M54171

 

---
Moving on, this account is no longer active. Best regards, Kelalek
- So Long, and Thanks for All the Fish

View solution in original post

2 Replies
Highlighted
Fleet Admiral
Fleet Admiral

Whenever I need to calculate outages, I use the snippet mentioned in this thread (3rd post): It's basically a wrapper to RAD application calendar.calc.interval.fc.

It seems to be written for SLA purposes - if the outage was within service hours - but if that's not in your plans, you can use the 24x7 work schedule as a schedule reference, so no reductions to the outage time will be made.

Maybe you don't need the all the functionality it offers, but it's a good all-around solution.

/t5/Service-Manager-Service-Center/SLO-duration-type-Calculation-End-of-the-month/m-p/4787115#M54171

 

---
Moving on, this account is no longer active. Best regards, Kelalek
- So Long, and Thanks for All the Fish

View solution in original post

Highlighted

Thanks Kelalek2!

This did the trick!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.