Need help in making a script to use the current score of a formula indicator

Rohit8
Tera Expert

Greetings!

I am working on an Asset Dashboard and currently trying to create an Indicator to show the "Number of Projected Desktop replacements - Current year".

So I already have a (formula) indicator "Average Age of Retired Assets" which uses "Summed age of assets DIVIDED BY Number of assets". The summed age is being calculated as per the asset's release date using this script.

var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};

//var seconds=function(x,y){return diff(x,y)/(1000);};

//var minutes=function(x,y){return diff(x,y)/(60*1000);};

//var hours=function(x,y){return diff(x,y)/(60*60*1000);};

//var days=function(x,y){return diff(x,y)/(24*60*60*1000);};

//var weeks=function(x,y){return diff(x,y)/(7*24*60*60*1000);};

var years=function(x,y){return diff(x,y)/(365*24*60*60*1000);};

years(current.u_avg_hw_release_date, score_end);

So is there a way, I can use the same script (with some modifications) in this new Automated Indicator so that while filtering to use the Deployed desktops only, it also uses the current score of the indicator "Average Age of Retired Assets" and includes only the ones in count which have the age EQUAL TO OR GREATER THAN the Average age.

Thanks a lot.

1 ACCEPTED SOLUTION

Adam Stout
ServiceNow Employee
ServiceNow Employee

You'll call the API and parse the results.   Take a look at the example here:



PAScorecard - Scoped


View solution in original post

6 REPLIES 6

Adam Stout
ServiceNow Employee
ServiceNow Employee

You'll call the API and parse the results.   Take a look at the example here:



PAScorecard - Scoped


That worked perfectly !! Thanks a zillion, Adam.