Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 11:55 PM
I got a requirement to show the attach button for the knowledge articles showing in the related search based on user having access to the knowledge article.
I have tried with the UI action visibility by using the below script.
var kb_article=resource.sys_id;
var requester=current.caller_id;
function kbAccess(kba) {
var kbGr = new GlideRecord('kb_knowledge');
kbGr.get(kba);
return (new KBKnowledge().canRead(kbGr));
}
var userToCheck = requester;
var originalUser = gs.getSession().impersonate(userToCheck );
var hasAccessToKBA = kbAccess(kba);
gs.getSession().impersonate(originalUser );
visible=hasAccessToKBA;
But we have used impersonate to check if the user have access to the knowledge article seems it is not working. Please suggest any alternate way to check the access if the requester of the incident have access to the knowledge article getting attached in the incident.
Solved! Go to Solution.