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

Brian Dailey1
Kilo Sage

Hi Steve,



Make sure that the field name on your table is actually 'company' and not 'u_company'.   If it's a field you have added to a table, or a table you have created, then this may be the case.   You might have to alter your refqual a little bit:



        (e.g.)         javascript:"u_company=" +gs.getUser().getCompanyID();  





Thanks,


-Brian


No, it's on the cmdb_ci_service table. Field is definitely "company".


Check to make sure the current user you're testing with has a Company associated with it.   If you're using an admin account, it might be local to the portal and not have a Company selected.




-Brian


Using my own account that has the testing company set that I want to see results for.