Difference between gs.hasRole(‘abc ’)and gs.getUser().hasRole(‘abc’) if I want to use in acl script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 08:19 AM
Difference between gs.hasRole(‘abc ’)and gs.getUser().hasRole(‘abc’) if I want to use in acl script. Which one is better. I saw same functionality when using both ways. Please suggest.
- Labels:
-
Case and Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 08:28 AM
Hi Vasavib1,
Please refer the link below. https://servicenowguru.com/scripting/user-object-cheat-sheet/
Hope this will be helpful.
Please mark answer as correct if it clarifies the doubt
Please mark the answer as helpful and correct.
Best Regards,
Rajat Choudhary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 08:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 09:10 AM
You are welcome vasavib1.
You can mark that answer helpful.Happy coding .
Please mark the answer as helpful and correct.
Best Regards,
Rajat Choudhary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 08:37 AM
Hi,
The gs.hasRole is a GlideSystem(gs) method.
The gs.getUser(),hasRole method is a glideUser method.
They both achieve the same thing.
Most people will set a var like
var user = gs.getUser();
and then pull multiple details from the user like;
user.getID();
user.getLastName();
If this solved you issue please ark my answer as correct or as helpful