- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2025 02:22 AM
called below script in a reference qualfier while calling passed a parameter but the value not getting pass script include function
Reference qualifier: javascript:newCIvalueretrieve().getCis(current.variables.name_of_application_service_you_want_to_map):
Script Include: var Civalueretrieve = Class.create();
initialize: function() {},
getCis: function(parentId) {
var parentIdValue "parentId;
gs.log("parentId sai testing" parentIdValue);
var relations = new GlideRecord('cmdb_rel_ci');
relations.addQuery("parent", parentIdValue);
relations.query();
var ciData [];
while (relations.next()) {
var cis new GlideRecord(cmdb_ci");
cis.addQuery("sys_id', relations.child.sys_id);
cis.query();
if (cis.next()) {
ciData.push(cis-getuniqueValue());
}
}
var strQuery new ArrayUtil().unique(ciData);
return "sys_idIN” + strQuery;
},
type: 'CIvalueretrieve
};
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:07 AM
then in that list collector variable you should give variable attributes so that the ref qualifier works
ref_qual_elements=name_of_application_service_you_want_to_map
add that in variable attributes
Also don't use gs.log(). use gs.info()
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2025 07:23 PM
Hi Ankur,
I have similar kind of issue, where I have applied reference qualifier on List collector. And the variable type which I passed is reference. The reference field value is passing as empty while calling the script include function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2025 08:13 PM
I have a similar issue, where
Please share on what variable type the ref qualifier is applied - List collector
Also share what's the variable type for "name_of_application"? - Reference
Where the value is not getting pass while calling the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:04 AM
@Ankur Bawiskar the ref qualifier is applied on the List collector variable type and the variable type of "name_of_application_service_you_want_to_map" is a Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:07 AM
then in that list collector variable you should give variable attributes so that the ref qualifier works
ref_qual_elements=name_of_application_service_you_want_to_map
add that in variable attributes
Also don't use gs.log(). use gs.info()
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 01:36 AM
Can we set default values to list collector field? based on the other reference field