Advanced Reference Qualifier: Company is active user's Company

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 06:16 PM
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?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 06:21 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 06:33 PM
No, it's on the cmdb_ci_service table. Field is definitely "company".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 06:57 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 08:10 PM
Using my own account that has the testing company set that I want to see results for.