The CreatorCon Call for Content is officially open! Get started here.

Reference qualifier is showing only one value

Kumar147
Tera Contributor

Hello,

I am calling script include in reference qualifier and i am getting only one value, instead of showing related values.

script include i am using:

 

    platform: function() {
        var app = current.cmdb_ci.getValue();
        var gr = new GlideRecord('u_rm_data_management');
        gr.addEncodedQuery('u_active=true^u_type=Choice^u_item=App Platform^u_applicationsLIKE' + app);
        gr.query();
        var result = [];
        while (gr.next()) {
            result.push(gr.sys_id.toString());
            return 'sys_idIN' + result.join(',');
        }
    },
 
adv ref qual condition: javascript: new scriptinclude().fucntion();
 
Please help in this.
20 REPLIES 20

You are returning a list of sys_ids from the u_rm_management table, so the reference field table must be the same table.  Otherwise, you need to change your script include logic to return a list of sys_ids from the 'different' table based on records from the data management table.

The table from which i am trying to get sys_ids and the App Platform field table is same. when i tried with same script include its showing correct value only but returning only one value. i tried the same script in background script, there i am getting all values.

You'll need to add some logs to your Script Include to see what is happening.  Start with 'app' as that's one difference between this script and what you would have run in the background script.  Also log the sys_ids or the Name or something meaningful that is pushed to the result, so you can confirm these are expected.

I tried writing logs at different levels, when i placed return in while loop, i am getting the sys_id(only one). and when i tried writing return outside of loop its only taking sys_id of cmdb while loading means On Load. I want it for on Change. when any value changed in cmdb_ci, related app platform values should be shown in reference qualifier.

If your 'app' script variable is not logging correct in all test cases, try passing it in from the reference qualifier instead

javascript: new appapplication().platform(current.cmdb_ci);

Then change the function declaration to

    platform: function(app) {

and remove the var app line