How call script include in catalog varaibales.

vallabha180
Tera Contributor

I have created 2 catalog variables. one is referencing to 'cmdb_ci_appl_sap' table, named as 'select_sap_sid' and another one is referencing to 'cmdb_ci' table, named as 'select_servers'.

Based on the "sap application" selected in 'cmdb_ci_appl_sap' field the respective assets of the sap application server should display in 'select_sap_sid' field.

I've written a script include for that and tried to call it in advanced reference qualifier of the select_servers variable.

"javascript:new TATADisplayResourceGroup().displaysapservers(current.variables.select_sap_sid)"

-----------------------------------------------

 displaysapservers: function(sysid) {

        gs.log(sysid, "insidescript");
        var rgs = "";

        var a = [];
        for (var i = 0; i <= 1; i++) {
            var gr = new GlideRecord("cmdb_rel_ci");
            //  gr.addEncodedQuery('parent.sys_class_name=cmdb_ci_appl_sap^child.sys_class_name=cmdb_ci_linux_server');

            // gr.addEncodedQuery('');
            gr.addQuery("parent", sysid);
            gr.query();
            while (gr.next()) {
                var child = '';
                if ((gr.child.sys_class_name == "cmdb_ci_linux_server") && (gr.child.operational_status != '6') && (gr.child.u_service_provider == 'tcs'))
                    rgs = rgs + gr.sys_id + ",";

                //return rgs;
                //  rgs.push(gr.sys_id);

            }
        }
        rgs = rgs.substring(0, rgs.length - 1);
        return "sys_idIN" + rgs;
    },

So please give me a solution for this.

Thank you!

0 REPLIES 0