Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Hide Create Incident button on Knowledge Table

vivek72
Tera Guru

Hi,

 

I have below 2 requirements and would like to understand the easiest way to implement these:

1. How shall I disable 'Create Incident' button on Knowledge table for a particular Knowledge base only.

    like out of 6, only members from 1 particular group shouldn't be able to see 'Create Incident' button.

2. How to disable Knowledge templates for some Knowledge bases, need only 1 template (sys_wizard_answer) for a particular Knowledge base, rest all templates should be visible for all Knowledge bases.

1 ACCEPTED SOLUTION

Hi @vivek72 ,

 

Can you update UI Macro = "kb_view_common" XML like below.

After line 6, add the code marked in bold to evaluate whether user is part of Group whom you need to exclude

 

<g:evaluate jelly="true">
var knowHelp = new SNC.KnowledgeHelper();
var showCreateIncident = !kbViewInfo.isInPopup && !jelly.sysparm_no_create_incident && !kbViewInfo.hideFeedbackOptions && RP.getParameterValue('sysparm_class_name') != "kb_knowledge_block";

// Add this section to check for group membership
var excludeGroup = gs.getUser().isMemberOf('Name of the Group to Exclude'); // Replace 'Name of the Group to Exclude' with the actual group name
if (excludeGroup) {
showCreateIncident = false; // Set to false if the user is a member of the excluded group
}

var showMoreInfo = !kbViewInfo.isInPopup && !jelly.sysparm_no_info;

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

View solution in original post

6 REPLIES 6

Hi @vivek72 ,

 

Can you update UI Macro = "kb_view_common" XML like below.

After line 6, add the code marked in bold to evaluate whether user is part of Group whom you need to exclude

 

<g:evaluate jelly="true">
var knowHelp = new SNC.KnowledgeHelper();
var showCreateIncident = !kbViewInfo.isInPopup && !jelly.sysparm_no_create_incident && !kbViewInfo.hideFeedbackOptions && RP.getParameterValue('sysparm_class_name') != "kb_knowledge_block";

// Add this section to check for group membership
var excludeGroup = gs.getUser().isMemberOf('Name of the Group to Exclude'); // Replace 'Name of the Group to Exclude' with the actual group name
if (excludeGroup) {
showCreateIncident = false; // Set to false if the user is a member of the excluded group
}

var showMoreInfo = !kbViewInfo.isInPopup && !jelly.sysparm_no_info;

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

vivek72
Tera Guru

thank you so much @G Ponsekar !!

it worked perfectly fine .