Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Function parameter passing as empty while calling the script include function in reference Qualifier

K Sai Krishna
Tera Contributor
1st field is of type reference -> name_of_application_service
 
2nd  field type is of list collector where I have applied the reference qualifier ->
javascript: new CIvalueretrieve().getCis(current.variables.name_of_application_service);
 
In the below script include log statement parentIdValue is coming as empty.
 
Script include : 
var CIvalueretrieve = Class.create();
CIvalueretrieve.prototype = {
    initialize: function() {},
 
    getCis: function(parentId) {
var parentIdValue =parentId.toString();
gs.log("parentId 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.addEncodedQuery('sys_class_name=cmdb_ci_win_server^ORsys_class_name=cmdb_ci_linux_server^nameISNOTEMPTY^install_statusIN1,0,4');
            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'
};
0 REPLIES 0