Using script in report servicenow

hind
Tera Contributor

Hi all !

 

In the RITM table (sc_req_item), each RITM has an associated "volumetry" field of integer type. I want to create an advanced report that displays the number of RITMs multiplied by the volumetry.

For example, if I have 3 requests with a volumetry of 3 for each, the result I should get should be: (1*3) + (1*3) + (1*3) = 9.

For this, I created a script include and called it in my report as mentioned below, but I get a result equal to 0.

Can someone help me?

 

Script include :

hind_0-1741708860452.png

 

Report : 

hind_1-1741708860438.png

 

thanks in advance !

3 REPLIES 3

Kieran Anson
Kilo Patron

Hi,

You'll need to upload your screenshots as attachments, they've been compressed and aren't readable 

Hi @Kieran Anson !

Thank you for your comment, tell me if it's Okey now ?

 

hind_0-1741778038934.png

 

hind_1-1741778104922.png

 

Viraj Hudlikar
Tera Sage

Hello @hind 

 

As per new screenshot shared it has function which is calculating as per your requirement. Now the thing you are doing in report is really out of context as you are trying to filter with SysID and calling script include but that also is wrong as you are just calling name of scriptinclude not the function. Also, if you call the function still your report will give result as zero as you are not returning sysid which will display count of ritm which has volumetry variable.

 

You can always test your script include by calling in background scripts and see what is return when function is called.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.