Export scores of formula indicator.

tsoct
Tera Guru

Hi all.

Is there any way I can export the score of formula indicator?

I am looking to create a scheduled job that sends the score of formula indicator via email.

 

Thanks!

1 ACCEPTED SOLUTION

Adam Stout
ServiceNow Employee
ServiceNow Employee

Score start and end give you the first and last date of the period (for daily, this is the same, for monthly, this is the first day of the month and the last).  You can then get the day of the week from this date decide to show it or NULL it out.

res = {{Number of open incidents}};
if(score_end.getDayOfWeekLocalTime() >= 6)
{
  res = null;
}
res;

find_real_file.png

View solution in original post

10 REPLIES 10

Adam Stout
ServiceNow Employee
ServiceNow Employee

Score start and end give you the first and last date of the period (for daily, this is the same, for monthly, this is the first day of the month and the last).  You can then get the day of the week from this date decide to show it or NULL it out.

res = {{Number of open incidents}};
if(score_end.getDayOfWeekLocalTime() >= 6)
{
  res = null;
}
res;

find_real_file.png

Awesome Adam! 

Just a silly question.. Should the script be added to "formula" session?

Once setting the value to null, mind to help me in getting the average score for the month?

 

Thanks!!

Adam Stout
ServiceNow Employee
ServiceNow Employee

I'm not sure what you mean by formula session.

As for the average, NULL should be excluded from an AVG so if you only have 20 weekdays in a month, I would expect that the average is based on the sum of the 20 divided by 20 (not the total number of days in the month).  However, I haven't tested that.

Hi Adam,

I mean should the script be added to the highlighted part?

find_real_file.png

Adam Stout
ServiceNow Employee
ServiceNow Employee

Yes.  The example above is a valid formula to show the number of open incidents on weeks days only.