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.

Make Republish Button visible to ownership group

avinashdubey103
Tera Guru

I have a requirement to make the republish button visible to members of ownership group .

Currently only admins can see this button 

 

Condiiton of UI Action 

!(new KBCommon().isStackNameDialog()) && (new KBKnowledge().canRepublish(current))

 

 

1 ACCEPTED SOLUTION

Sebastian R_
Kilo Sage

@avinashdubey103 no problely not because the publish function "new KBKnowledge().republish(current);" in the UI Action also checks if you can republish which would not work with your function.

View solution in original post

5 REPLIES 5

Sebastian R_
Kilo Sage

You can overwrite the behaviour in Script Include KBCommon with function "canRepublishKnowledge". Please test the following

var KBCommon = Class.create();
KBCommon.prototype = Object.extendsObject(KBCommonSNC, {

    type: 'KBCommon',

	canRepublishKnowledge: function(itemGr) {
		// Case 1: Pass in a valid value
		if (!itemGr)
			return false;

		// Case 2: If the record is retired continue
		if (itemGr.workflow_state != "retired")
			return false;

		// Case 3: If user is admin continue
		// Customization: Ownership group should be possible to republish article
		if (!this.isAdminUser(itemGr) && !this.isGroupMemberOrManager(itemGr[this.OWNERSHIP_GROUP]))
			return false;

		// Default: Allow user to republish knowledge
		return true;
	},
});

@Sebastian R_ 

 i am trying to implement this as dot walkling :in the UI Action condition 

 

gs.getUser().isMemberOf(current.kb_knowledge.ownership_group)

not sure is it possible ?

 

Hi @Sebastian 
Your solution is worked for me, but i want to understand the functionality behind this or connection of script includes, I have posted seprate post on this colud you please go to below article and help me to undertand this?
Thank you
https://www.servicenow.com/community/itsm-forum/knowledge-article/m-p/3301626#M542661

Sebastian R_
Kilo Sage

@avinashdubey103 no problely not because the publish function "new KBKnowledge().republish(current);" in the UI Action also checks if you can republish which would not work with your function.