The CreatorCon Call for Content is officially open! Get started here.

How do i make math calcule in Sevicenow?

122932
Tera Expert

Hi 

 

How do i make math calcule in Sevicenow?

 

Tks.

1 ACCEPTED SOLUTION

I need learn how to make every type of calculation using your tool, i would like learn how. 

 

if there is any scripts, that would help me too.

 

tks.

 

 

View solution in original post

5 REPLIES 5

Allen Andreas
Administrator
Administrator

Hello,

Please give a bit more information.

Your post isn't very clear on what you'd like to do, where (other than the topics you picked, but most people pick random things, haha), and an example, etc.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I need learn how to make every type of calculation using your tool, i would like learn how. 

 

if there is any scripts, that would help me too.

 

tks.

 

 

Hi,

It's still not very clear what you'd like to do, but I'll start at the very basic level, this is how to do basic math in JavaScript: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Math

Examples from documentation:

Operator Name Purpose Example
+ Addition Adds two numbers together. 6 + 9
- Subtraction Subtracts the right number from the left. 20 - 15
* Multiplication Multiplies two numbers together. 3 * 7
/ Division Divides the left number by the right. 10 / 5
% Remainder (sometimes called modulo)

Returns the remainder left over after you've divided the left number into a number of integer portions equal to the right number.

8 % 3 (returns 2, as three goes into 8 twice, leaving 2 left over).

** Exponent Raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times. It was first Introduced in EcmaScript 2016. 5 ** 2 (returns 25, which is the same as 5 * 5).

You can then navigate to System Definition > Scripts - Background, for example:

find_real_file.png

and practice doing some math for example:

var val1 = 0;
var val2 = 2;
var result = val1 + val2;
gs.info("The final is: " + result);

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hello @JULIO SANTOS 

I see you marked your own reply as Correct?

If my reply helped resolve your issue, please mark my reply as Correct?

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!