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.

When knowledge article attached KB content coping to case worknotes . How can we stop that . We don't need the content .

skkkk
Giga Contributor

When knowledge article attached KB content coping to case worknotes . How can we stop that . We don't need the content .

1 ACCEPTED SOLUTION

skkkk
Giga Contributor

Thanks Vinitha ,



Temporary   I done the create new field and through UI policy dine it . Still notification is coming . Have to fix .



Once again thanks for you help .


View solution in original post

31 REPLIES 31

Name of script include : cxs_Knowledge



Update this part of code :



find_real_file.png



Thanks,


Vinitha.K


skkkk
Giga Contributor

Hello Vinitha,



Thanks for your quick response . Still the issue is not solved . Changed


the code and tested ( created new script include for that , where this


script include is calling.


cxs_Knowledge



On Mon, Mar 13, 2017 at 3:13 PM, vinitha <community-no-reply@servicenow.com>


YOU need not create a new one.


You must change the below script include I shared and do not change anything else.


This should work. Why do you create a new one?


Please share your code.



Thanks,


Vinitha.K


skkkk
Giga Contributor

it's read only based on protection policy. Hence created new script


include .




xxxxxx_cxs_knowledge.prototype =


Object.extendsObject(AbstractAjaxProcessor, ,


fields: []


};


if (kbSysId != "") {


var article = new GlideRecord("kb_knowledge");


// if (article.get(kbSysId))


article.addQuery('sys_id',kbSysId);


article.query();


if(article.next())


{



if (!article.canRead())


return new JSON().encode(response);



response.article.id = article.getUniqueValue();


var s = gs.getMessage("Knowledge article") + " " +


article.number + ":\n";


if (gs.getProperty("glide.ui.security.allow_codetag",


"true") != "true")


s += article.short_description;


else {


var displayValue = SNC.GlideHTMLSanitizer.sanitize(new


KnowledgeHelp(article).findDisplayValue());


s += "[code]" + displayValue + "[/code]";


}




if(article.u_publish_to_customer_portal==true){


response.article.content = s;


response.fields = "comments".split(",");


} else {


response.article.content = s;


response.fields = "work_notes".split(",");


}


}


}


return new JSON().encode(response);


},


isKnowledgeSearchAvailable: function() {


var searchField = "" + this.getParameter("sysparm_searchField");


var parts = searchField.split(".");


if (parts.length != 2)


return false;


var grTable = new GlideRecord(parts[0]);


var geTarget = grTable.getElement(parts[1]);


return geTarget.getBooleanAttribute("knowledge_search");


},


type: 'xxxxx_cxs_knowledge'


});




On Mon, Mar 13, 2017 at 3:34 PM, vinitha <community-no-reply@servicenow.com>


It should not be write protected. DO you have complete Knowledge access?


Here is the code:



var cxs_Knowledge = Class.create();



cxs_Knowledge.prototype = Object.extendsObject(AbstractAjaxProcessor, ,


fields: []


};



if (kbSysId != "") {


var article = new GlideRecord("kb_knowledge");


if (article.get(kbSysId)) {



if (!article.canRead())


return new JSON().encode(response);



response.article.id = article.getUniqueValue();



// var s = gs.getMessage("Knowledge article") + " " + article.number + ":\n";


// if (gs.getProperty("glide.ui.security.allow_codetag", "true") != "true")


// s += article.short_description;


// else {


// var displayValue = SNC.GlideHTMLSanitizer.sanitize(new KnowledgeHelp(article).findDisplayValue());


// s += "[code]" + displayValue + "[/code]";


// }



//added vy Vinitha.K


//11.02.2016


//Return a link to the knowledge article instead of the full article text


var s = "Knowledge article " + article.number + ": " + article.short_description + "\n";


if (gs.getProperty("glide.ui.security.allow_codetag", "true") != "true")


s += gs.getProperty('glide.servlet.uri') + "kb_view.do?sysparm_article=" + article.number;


else {


s = "Knowledge article ";


s += '[code]<a title="tProperty('glide.servlet.uri') + 'nav_to.do?uri=kb_view.do?sysparm_article=' + article.number + '" href="' + gs.getProperty('glide.servlet.uri') + 'nav_to.do?uri=kb_view.do?sysparm_article=' + article.number + '" style="color:blue">' + article.number + '</a>[/code]' + ": " + article.short_description + "\n";


}



response.article.content = s;


response.fields = gs.getProperty("glide.knowman.attach.fields", "").split(",");


}


}



return new JSON().encode(response);


},



isKnowledgeSearchAvailable: function() {


var searchField = "" + this.getParameter("sysparm_searchField");



var parts = searchField.split(".");



if (parts.length != 2)


return false;



var grTable = new GlideRecord(parts[0]);


var geTarget = grTable.getElement(parts[1]);


return geTarget.getBooleanAttribute("knowledge_search");


},



type: "cxs_Knowledge"


});