Client Callable Script Include returning null

TerryC03
Tera Expert

Hello,

When I enter my script include into a report, the sysID is returning null.

TerryC03_0-1709854242270.png

What would be the reason for this? Below is my script include:

TerryC03_1-1709854359913.png

 

1 ACCEPTED SOLUTION

Hi @TerryC03 tested in my PDI, works fine now. Follow the below steps

1. Create a client callable script include like below

latestSprint: function(){
var sprintID;
var answer = []; // since you want more than 1 record use array to push values
var gr = new GlideRecord('sn_safe_sprint');
gr.setLimit(3);
gr.orderByDesc('sys_updated_on');
gr.query();

while(gr.next()){
answer.push(gr.getValue('sys_id'));
}

return answer.toString();
},
HarishKM_0-1709878525947.png

 

in your report use in condition like this

sysid ISONE OF javascript: new scriptincludename().latestSprint()

result:

HarishKM_2-1709878722145.png

 


 

 

Regards
Harish

View solution in original post

25 REPLIES 25

SanjivMeher
Kilo Patron
Kilo Patron

Is there a reason you marked the script include client callable?

You should be using a server side script include.

Also in you script include, you are not setting the sprintID with the sysid inside the while loop. after gs.log, you should set the sprintID.

And in the report, while calling, it should be new sprintUtil().latestSprint(). So you are missing () after the sprintUtil


Please mark this response as correct or helpful if it assisted you with your question.

It's client callable to use javascript: new sprintUtil().latestSprint() in the report filter. Is there a such thing as a "server-side" script include? How should I set the sprintID?

Yes. Create a new ScriptInclude with Client Callable unchecked and write you function there. And then call it from the report as javascript:new scriptName().functionName();

 

Also inside the while loop, use sprintID=gr.sys_id; to populate the sprintID which you will use in the report.


Please mark this response as correct or helpful if it assisted you with your question.

Ok. I will try it soon. Thanks.