Creating knowledge from a change

snadmin123
Mega Expert

I want to be able to create knowledge from Change. I exposed the Knowledge field but on closure of change dont see knowledge article created even the knowledge checkbox is checked. Is there anything else that needs to be set up.

Thanks in advance

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello SP,



You have to write a BR on change table to make that work. Just double check if there is any BR created already on "Knowledge" field on change table.


To create you can refer the OOB BR "Incident Create Knowledge" on incident table.


View solution in original post

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello SP,



You have to write a BR on change table to make that work. Just double check if there is any BR created already on "Knowledge" field on change table.


To create you can refer the OOB BR "Incident Create Knowledge" on incident table.


Hi Pradeep,

 

I am not able to create knowledge article from change.

 

I have created the business rule.But still i am not able to create knowledge article from change management.

 

Can you please help me on this?

 

Regards,
Alok Gupta

Hi Alok ,

 

Use this business rule i created and its working completely fine.

sakshinitna_0-1764598280771.png

var sub = gs.getProperty('glide.knowman.submission.workflow');

if (sub == 'true')
submitCandidate();
else
submitDirect();

function submitDirect() {
var kb = new GlideRecord("kb_knowledge");
kb.source = current.sys_id;
kb.short_description = current.short_description; // Change short description
kb.sys_domain = current.sys_domain;
kb.text = current.close_notes.getHTMLValue(); // You can change to description or closure notes
kb.workflow_state = 'draft';
kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb", "dfc19531bf2021003f07e2c1ac0739ab");
kbSysId = kb.insert();

if (kbSysId)
gs.addInfoMessage(gs.getMessage(
'Knowledge Article created: {0} based on closure of Change: {1}',
[kb.number, current.number]
));
}

function submitCandidate() {
var gr = new GlideRecord('kb_submission');
gr.parent = current.sys_id;
gr.short_description = current.short_description; // Change description
gr.sys_domain = current.sys_domain;
gr.text = current.close_notes.getHTMLValue(); // You can use description/close notes
gr.insert();

gs.addInfoMessage(gs.getMessage(
'Knowledge Submission created: {0} based on closure of Change: {1}',
[gr.number, current.number]
));
}

 

 

snadmin123
Mega Expert

That's a lot. I got it working.