
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 04:38 AM
Hi, without using glideRecord on an ACL script, what would be the best way to script my ACL so that it checks the current users country code to determine whether they can view the record.
Appreciate that a BR is probably best, but there are currently a lot of ACLs in play, so just want to update the existing ACLs.
So for example, if the current users country code is "united Kingdom" or "England", they can view the record. But if the current users country code is anything different, they cant.
Many thanks in advance
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 04:44 AM
Hi,
without GlideRecord it's not possible as there is no direct way to obtain country code.
you can get location or company directly using this but not country code
gs.getUser().getCompanyID();
gs.getUser().getLocation()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 04:44 AM
Hi,
without GlideRecord it's not possible as there is no direct way to obtain country code.
you can get location or company directly using this but not country code
gs.getUser().getCompanyID();
gs.getUser().getLocation()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 04:49 AM
You can use this. It is working for me
gs.getUser().getRecord().getValue("country");
Thanks!
Uma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 04:54 AM
Below is what I used and what I received as an output in background script. You can use the same
gs.print(gs.getUser().getRecord().getValue("country"));
Output: *** Script: IT
Please mark this correct and helpful if it really helps
Regards!
Uma