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.

LLM topic Visibility Restrictions

kumari1
Tera Contributor

Hi,

I created two LLM topics and published them. After publishing, the topics appeared in the chatbot. Then I created two users and assigned them the snc_internal role. I want each user to see only one specific topic. So, I created two groups and two roles, and assigned each user their respective group and role. But when I added these roles in the topic visibility settings, it didn’t work.

 

      Can anyone who is working on this please help me regarding the LLM topic

table name: sys_cs_topic here also i added role and script but it didn't work.

 

here is the script 

 

(function() {
var user = gs.getUserID();

if (gs.hasRole('itil') || gs.hasRole('pharmacy_employee') || gs.hasRole('admin'))
return true;

return false;
})();

 

(function() {
var user = gs.getUserID();

if (gs.hasRole('itil') || gs.hasRole('power_outage') || gs.hasRole('admin'))
return true;

return false;
})();

 

kumari1_0-1762594453875.png

 

1 REPLY 1

kaushal_snow
Giga Sage

@kumari1 ,

 

The reason is that topic visibility is primarily controlled by the Is Topic Visible and Is Topic Discoverable flags and the system evaluates those first before custom scripts (see Control topic discovery and visibility).....Instead of relying on the script alone, the correct pattern is to set Is Topic Visible = false for topics you want hidden by default and then add a visibility script that returns true only when the user has the specific custom role or group membership you’ve defined......Then ensure Is  topic discoverable is toggled according to whether you want the topic to appear in keyword suggestions or only via direct invocation.......

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/