We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Creating the Knowledge article using scripts

Not applicable

Creating the Knowledge article using scripts

2 REPLIES 2

Not applicable

Hi @Community Alums ,

Please refer below script this will helps you

var gr = new GlideRecord('kb_knowledge');
gr.initialize();
gr.short_description = 'KB Article from Script';
gr.insert();

Result

SarthakKashyap_0-1718086889394.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

SN_Learn
Kilo Patron

Hi @Community Alums ,

The below script will create new knowledge article:

 

var grKnowledge = new GlideRecord('kb_knowledge');
grKnowledge.initialize();
grKnowledge.setValue('kb_knowledge_base', 'a7e8a78bff0221009b20ffffffffff17'); //Knowledge base - 'IT'
grKnowledge.setValue('kb_category', 'f23c6552ff0131009b20ffffffffffa9'); //Category - 'IE'
grKnowledge.setValue('valid_to', '2024-06-10');
grKnowledge.setValue('short_description', 'Knowledge Article created by Script');
grKnowledge.setValue('text', 'This is article body');
grKnowledge.insert();

 

Created article:

 

SN_Learn_0-1718088043576.png

 

Please accept my solution if it works for you and thumps up to mark it as helpful.

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.