Script include returns array of values but not getting showed in variable of reference qualifier.

Anusha Anus
Tera Expert

Script include returns array of values, which we can see in logs. But in the catalog item variable nothing is  getting displayed.

 

Please do the needful.

 

Regards,

Anus

1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

Hi @Anusha Anus ,

Everything is correct in your case, you just need to make small change in your Script Include on Line 11.

Your Line 11 is like below:

ans.push(grinc.number.toString());

 

Just change it like below:

ans.push(grinc.sys_id.toString()); 

 

As you have applied query sys_idIN<pass the list sys_ids of incidents instead of numbers>

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

5 REPLIES 5

Anil Lande
Kilo Patron

Hi @Anusha Anus ,

Everything is correct in your case, you just need to make small change in your Script Include on Line 11.

Your Line 11 is like below:

ans.push(grinc.number.toString());

 

Just change it like below:

ans.push(grinc.sys_id.toString()); 

 

As you have applied query sys_idIN<pass the list sys_ids of incidents instead of numbers>

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

You can check below for improving performance and avoiding unwanted query when filtering data.

https://www.servicenow.com/community/now-platform-articles/improving-advanced-reference-qualifier-pe...

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

@Anusha Anus Glad to know provided solution worked for you.

But you can check the solution proposed by @Brad Bowman  , that is best approach and you don't need script include call and unnecessary GlideRecord query.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Brad Bowman
Kilo Patron
Kilo Patron

The values in the array need to be sys_ids, as this is what a reference type variable/field needs for the reference qualifier. So check the box for Client callable, and change your array population line, and you should be all set:

ans.push(grinc.sys_id.toString());

Note that this is a good skill to have in your toolbelt, but in this case since you are doing a simple glide record on the same table as the referenced table (incident) it looks like you can also do this with a different reference qualifier, instead of calling a Script Include.

BradBowman_0-1705932301963.png