Not getting values in Reference qualifier

Rachael12
Tera Contributor

Hi,

I have created 1 reference type variable and referenced it to table 'Contact'.
I want that users same as logged in users account should only be visible in the dropdown.
So I used the advanced qualifier and wrote the qual as '

javascript: 'active=true^account='+gs.getUser().getCompanyID();

but in dropdown I am only getting the logged in user. Where is it going wrong. Please advice

7 REPLIES 7

AMan1997
Tera Guru

Hi,

 

The code seems correct.
Can you try logging out of session and login again and then try?

Related posts:
https://community.servicenow.com/community?id=community_question&sys_id=fb58025fdb553c50981a0b55ca96...

https://community.servicenow.com/community?id=community_question&sys_id=694d5736dbd62850b1b102d5ca96...

If it still doesn't work, then check the field account on table once.

Thanks,

Viraj Hudlikar
Giga Sage

Hi Rachael,

Over Contact table, did you try same? Are you getting results?

In Ref Qual you are providing company id hoping that value is not blank if yes set some random company value and the account field used is a reference to the company table if not please check which field it should be used for further dotwalk.

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.

Thanks & Regards,
Viraj Hudlikar.

Hitoshi Ozawa
Giga Sage
Giga Sage

I've tested this on my instance and found that gs.getUser().getCompanyID() in not returning company id.

Would recommend write a script include to return company id and use that in reference qualifier.

var UserInfo = Class.create();
UserInfo.prototype = {
    initialize: function() {},
    getCompanyID: function() {
        var grUser = new GlideRecord('sys_user');
        if (grUser.get(gs.getUserID())) {
            return grUser.company;
        }
    },
    type: 'UserInfo'
};

Reference Qualitifier

javascript: new UserInfo().getCompanyID();

I've tested getCompanyID() before and it was working. It may be due to the upgrade. It doesn't seem to be working now.