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

Would this still work if the application scope is not global? The application scope is Performance Analytics Content Pack for Essential SAFe.

Hi @TerryC03 When you create a script include in global scope ensure you select accessible from all scopes like below

HarishKM_1-1709879325102.png

 

 

and in your report condition call like this

in your report use in condition like this

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

Regards
Harish

This does work. Thank you for the help! However, when I apply the report to an interactive filter on the "SAFe Team Dashboard", the sys_ids remain the same. I was hoping to change the 3 latest completed sprints according to SAFe Team.

Hi @TerryC03 i think you need to add one more query to get only closed complete sprints. add the bolded line to your script include, and try closing few sprints that should update your report data

var gr = new GlideRecord('sn_safe_sprint');
gr.addEncodedQuery('state=3');// get only close complete
gr.setLimit(3);

Regards
Harish

That did not work, unfortunately. I'm looking for something more dynamic. For example, on the SAFe Team Dashboard, when the SAFe Team is selected, I would like to view its 3 latest completed sprints.