Called script include using reference qualifier

GBS
Tera Contributor

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
};

 

1 ACCEPTED SOLUTION

@GBS 

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

AnkurBawiskar_0-1736770047027.png

 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

14 REPLIES 14

@GBS 

based on other reference value you can set comma separated sysIds in list collector

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

function onLoad()

var selectedIDs= '53958ff0c0a801640171ec76aa0c8f86,5f8af237c0a8010001a932999458b83a';

g_form.addInfoMessage("right bucket testing" + selectedIDs);

g_form.setValue('ci_values', selectedIDs);

I tried by giving hard coded values but it is not working

@GBS 

seems due to reference qualifier it's not allowing

Try to set the sysIds as comma separated values in default value of that variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

there is no reference qualifier at all and as you said If I give the sysids in the default field it's working as expected but actually as per my initial post whatever the values I'm getting from the above script include should be there in the right bucket of the list collector now I'm looking for the syntax how to configure in client script

@GBS 

right side means you are looking to use native view and not portal

for that check this blog from me which I created some years ago

Dynamically set list collector on change of variable 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader