VA Topic should be visible based on logged in user role

divya216
Tera Contributor

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!

10 REPLIES 10

Hi @divya216 ,

After saving the script save the Topic and Published it then clear the cache and open a new browser window and then check. I tried this and it is working for me. Don't continue the same session. Try this in a new session.

 

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023