Call a property in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 07:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 09:53 PM
Glad to know that my script worked.
for role check I already mentioned this
if(!gs.hasRole('admin')){
}
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
02-21-2022 09:55 PM
I have tried this out but it's not working 😞 . But if I remove this condition, it works.
But I need to check whether the user has an admin role or none before filtering the records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 10:52 PM
Hi,
!gs.hasRole('admin') will work
Did you check by adding logs if it went inside that if or not?
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
02-22-2022 02:12 PM
Hello Ankur, unfortunately logs does not work when you use the script include on a dynamic filter.
Since the script include is client callable and called in a filter, gs.property and gs.log will not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 06:10 PM
I think this is not working since if a user is not admin, it restricts the access to the sys_properties table that's why this does not work when the user does not have admin role.
Basically if admin, calling the property by gliderecord works, but if not admin, it does not.