VA Topic should be visible based on logged in user role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 03:39 AM
Hello
I want to hide the VA topic if user don't have an 'snc_internal' role.
I have tried below approach
(function execute() {
var udc = new GlideRecord('sys_user_role');
udc.addQuery('sys_id','7fcaa702933002009c8579b4f47ffbde');
udc.query();
if(udc.next()){
return true;
}
else {
return false;
}
})()
But this is not working as expected.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 05:26 AM
Hi @divya216 ,
Can you try this code in script of Context field in Additional properties:
var role = vaContext.role == 'snc_internal' ? true : false;
return role;
Regards,
Badal Khojare
Community Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 07:08 AM
Hi @divya216 ,
Please let me know if this still does not work for you or there is some other issue.
Regards,
Badal Khojare
Community Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 10:39 PM
Hi,
No its not working yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 10:53 PM
Hi @divya216 ,
Can you share screenshot of your script that you pasted in your Context script. It should look like :
(function execute() {
var role = vaContext.role == 'snc_internal' ? true : false;
return role;
return true;
})()
This script you have to paste by going to Topic > Properties > Advanced properties > Context > Select Script option > Click on Edit script and paste this script
Regards,
Badal Khojare
Community Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 11:15 PM - edited 10-19-2023 11:16 PM
Hii,
Topic is not visible to the snc internal role as well.
Please find the attached screenshot below: