KB article checkout button is now showing

William08
Tera Contributor

Hi all,

How to override the oob KBVersioningSNC script include and add the additional requirement to existing script behavior.

 

Additional requirement

Category hardware should be visible to Group A members 

Category network should be visible to Group B members 

 

Thanks

1 ACCEPTED SOLUTION

Bert_c1
Kilo Patron

Hi William,

 

I see the KB you found, and based on the recommendation there, I would comment out the whole "if" block. As in:

 

	canCheckout: function(current){	
		if(gs.getProperty('glide.knowman.allow_edit_global_articles')=='false' && this.isArticleReadOnlyBasedOnDomain(current))
			return false;
		if(this.isExternalArticle(current))
			return false;
		if(!this._isValidVersion(current))
			return false;
		if(current.workflow_state!=this.MAJOR_STATE)
			return false;
		if(this._getCheckedoutRecord(current))
			return false;
		//If Ownership Group exist but user is not a member
		/*
		if(this.isValidFieldWithValue(current,this.OWNERSHIP_GROUP)){
			if(this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
				return true;
			else if(gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
				return true;
			return false;
		}else if(!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
			return false;
		*/
		return true;
	},

 

Your script has an "else if" but no prior "if".  If you want that last part, then use:

 

    if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
            return false;

        return true;

View solution in original post

4 REPLIES 4

Bert_c1
Kilo Patron

Hi william08,

 

That was asked by another here today, you can edit the KBVersioning script include to enhance/override what is in the KBVersioningSNC script include.

Hi Bert,
 
i overrided it when i comment out the lines according to the below kb article it is throwing error. could you please help
 
 

 

var KBVersioning = Class.create();

KBVersioning.prototype = Object.extendsObject(KBVersioningSNC, {
    canCheckout: function(current) {

        if (gs.getProperty('glide.knowman.allow_edit_global_articles') == 'false' && this.isArticleReadOnlyBasedOnDomain(current))
            return false;
        if (this.isExternalArticle(current))
            return false;
        if (!this._isValidVersion(current))
            return false;
        if (current.workflow_state != this.MAJOR_STATE)
            return false;
        if (this._getCheckedoutRecord(current))
            return false;


        // //If Ownership Group exist but user is not a member
        // if (this.isValidFieldWithValue(current, this.OWNERSHIP_GROUP)) {
        //     if (this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
        //         return true;
            else if (gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
                return true;
          return false;
    //}
    else if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))

            return false;
        return true;



    },
    type: 'KBVersioning'
});

 

Bert_c1
Kilo Patron

Hi William,

 

I see the KB you found, and based on the recommendation there, I would comment out the whole "if" block. As in:

 

	canCheckout: function(current){	
		if(gs.getProperty('glide.knowman.allow_edit_global_articles')=='false' && this.isArticleReadOnlyBasedOnDomain(current))
			return false;
		if(this.isExternalArticle(current))
			return false;
		if(!this._isValidVersion(current))
			return false;
		if(current.workflow_state!=this.MAJOR_STATE)
			return false;
		if(this._getCheckedoutRecord(current))
			return false;
		//If Ownership Group exist but user is not a member
		/*
		if(this.isValidFieldWithValue(current,this.OWNERSHIP_GROUP)){
			if(this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
				return true;
			else if(gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
				return true;
			return false;
		}else if(!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
			return false;
		*/
		return true;
	},

 

Your script has an "else if" but no prior "if".  If you want that last part, then use:

 

    if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
            return false;

        return true;

Hi Bert 

 

Thanks a lot for the help