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.

Calculate Sum of Integer Values into Column

Brian S1
Mega Contributor

Hi Everyone,

I am attempting to calculate a 'Total Score' column with the sum of 10 integer fields. I have tried creating a business rule to calculate the value, however, the below code is not working. 

find_real_file.png

find_real_file.png

 

Can someone take a look to see what I am missing? Any help would be greatly appreciated.

Thank you,

Brian

1 ACCEPTED SOLUTION

try

var k = ((a + b  + c + d + e + f + g + h + i + j)/10).tofixed(2);

View solution in original post

5 REPLIES 5

Mike Patel
Tera Sage

try

var k = a + b  + c + d + e + f + g + h + i + j;

Thanks, Mike! This worked. Now if I wanted to divide this value by the number of fields (10) to find the average to a decimal value, would it be something like this var k = (a + b  + c + d + e + f + g + h + i + j)/10;? I think this solution alone would work, but would really like it to end in an average decimal value.

Thanks again!


Brian

try

var k = ((a + b  + c + d + e + f + g + h + i + j)/10).tofixed(2);

That worked! Thank you so much!