Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Badal Khojare
Mega Sage

Hi @divya216 ,

To hide topics based on role Go to Topic > Properties tab > Advanced properties > Who can access this topic > System Roles.

You can add snc_internal to System Roles.

 

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

Hello @Badal Khojare 
We have tried but its not working.
Thank you!

 

Hi,

You tried flushing the cache after adding role and publishing the topic? Cache sometimes play a significant part. Also topic you want to have in VA Chat and not in designer right?

 

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

Hello @Badal Khojare ,
Yes in the VA chat when we click on show me everything some topics should only be visible to the 'snc_internal' role.