Business rule Incident Create Knowledge

misolarz
Tera Expert

Hello all,

 

New to scripting and need some help, is there a way to change the where the articles are going to be in draft state to a different knowledge base rather than default "Knowledge". I tried changing the sys id in bold to another knowledge base but that didnt work, any help is greatly appreciated.

 

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;
    kb.sys_domain = current.sys_domain;
    kb.text = current.comments.getHTMLValue();
    kb.workflow_state = 'draft';
    kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb", "SYS_ID of knowledge base?");
    kbSysId = kb.insert();
    if (kbSysId)
        gs.addInfoMessage(gs.getMessage('Knowledge Article created: {0} based on closure of Incident: {1}', [kb.number, current.number]));
}

function submitCandidate() {
    var gr = new GlideRecord('kb_submission');
    gr.parent = current.sys_id;
    gr.short_description = current.short_description;
    gr.sys_domain = current.sys_domain;
    gr.text = current.comments.getHTMLValue();
    gr.insert();
    gs.addInfoMessage(gs.getMessage('Knowledge Submission created: {0} based on closure of Incident: {1}', [gr.number, current.number]));

}
1 ACCEPTED SOLUTION

Anand Kumar P
Giga Patron
Giga Patron

Hi @misolarz ,

Insted this : kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb", "SYS_ID of knowledge base?");

 

use this:

kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb");

 

 

 

if glide.knowman.task_kb system property have knowledge base sys_id as value it will insert record 

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

View solution in original post

2 REPLIES 2

Uncle Rob
Kilo Patron
    kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb""SYS_ID of knowledge base?");

This part doesn't look right.  gs.getProperty simply looks up the value of the provided property.  You don't need a second parameter to "feed" it a sys_id.   I think you want to GET a sys_id, no?

Anand Kumar P
Giga Patron
Giga Patron

Hi @misolarz ,

Insted this : kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb", "SYS_ID of knowledge base?");

 

use this:

kb.kb_knowledge_base = gs.getProperty("glide.knowman.task_kb");

 

 

 

if glide.knowman.task_kb system property have knowledge base sys_id as value it will insert record 

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand