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

Brad Bowman
Kilo Patron
Kilo Patron

You are returning in the while loop, so returning one value after it is retrieved by the GlideRecord.  Put this outside of the loop instead

    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(',');
        
    },

Hello @Brad Bowman  

when i tried that the field type is changing from reference to choice and not showing related values. please find the screen shots of that.

before

Kumar147_1-1730206703281.png

after

Kumar147_0-1730206687862.png

 

Is this a reference field on the u_rm_data_management table?  What is the column on this table with Display = true?  Without any reference qualifier what do you see?

Hello @Brad Bowman  

This is a reference field on different table which is getting data from u_rm_data_management table. in u_rm_data_management table there is list type field which is getting data from cmdb_ci.

the column with Display true is Value column nothing but a name. i didn't see any value after the field type got changed.