Advanced Reference Qualifier: Company is active user's Company

stevejarman
Giga Guru

Hi - I have a table with a field called "company" that is a reference to Company. I'm trying to apply an advanced reference qualifier that will filter that table for records matching the current user's company. I just can't get it to work though - I get no results.

My reference qualifier is:

javascript:"company=" +gs.getUser().getCompanyID();

If I run this portion in a background script:

gs.log(gs.getUser().getCompanyID());

I get the expected sys_id.

I've also tried:

javascript:"company=" +gs.getUser().getCompanyRecord().sys_id;

What am I doing wrong?

13 REPLIES 13

Abhinay Erra
Giga Sage

What is the field name on the reference table? Is it :company" or "u_company"


chris_smith
Kilo Expert

Hi Steve, are you talking about from a list view? Like if I clicked on Business Services in the left Nav then I should see the services associated with my company?


No, this is a variable in a variable set which is being shown as a catalog item.



ServiceNow.jpg


Try this: javascript:'sys_id=' + gs.getUser().getCompanyID()


That wouldn't work though - how would it know that I'm referring to the company field?