- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:04 AM
Hi,
I have a simple request that I want the "new" button on request table only visible for users who are member of a specific group AND who are from a specific company.
My condition looks like this: gs.getUser().isMemberOf(gs.getProperty('group.test.admin')) && gs.getUser().company == 'Company Name'.
The first part of the condition works (the ismemberof property part), but when I add the second part (company), the new button no longer appears. I've checked that the user is in that specific company. Is there something wrong with the condition?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:07 AM
Hi,
you can use the below to get the company
getCompanyRecord() | Returns the company GlideRecord of the currently logged-in user. | var company = gs.getUser().getCompanyRecord(); |
So your Condition on UI actions becomes something like :
gs.getUser().isMemberOf(gs.getProperty('group.test.admin')) && gs.getUser().getCompanyRecord().name == 'Company Name'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:08 AM - edited 10-10-2023 04:09 AM
Hi @JordyZ ,
for company please use below syntaxt it will return sysid of the company
gs.getUser().getCompanyID(); == "company_sys_id"
Please mark helpful if works
Thanks
Mohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:07 AM
Hi,
you can use the below to get the company
getCompanyRecord() | Returns the company GlideRecord of the currently logged-in user. | var company = gs.getUser().getCompanyRecord(); |
So your Condition on UI actions becomes something like :
gs.getUser().isMemberOf(gs.getProperty('group.test.admin')) && gs.getUser().getCompanyRecord().name == 'Company Name'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 04:08 AM - edited 10-10-2023 04:09 AM
Hi @JordyZ ,
for company please use below syntaxt it will return sysid of the company
gs.getUser().getCompanyID(); == "company_sys_id"
Please mark helpful if works
Thanks
Mohit