Submit Knowledge Article in Review state using UI Action

Uttam Sai
Tera Contributor

Hi,

I have created a UI Action on Outage form which creates a KB Article using below script . The requirement is to Submit Knowledge Article in Review state , currently the KB Article is generating Draft state  . Could you please help me with the requirement.

 

Thank you 
Uttam Sai S

 

var kb = new GlideRecord('kb_knowledge');

kb.initialize();

kb.short_description = current.short_description;

kb.text = current.details;

kb.insert();

 

1 ACCEPTED SOLUTION

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Uttam Sai ,

You can use UI action as below :-

GunjanKiratkar_0-1668876160096.png

var kb = new GlideRecord('kb_knowledge');
kb.initialize();
kb.workflow_state = 'review';
kb.short_description = current.short_description;
kb.text = current.details;
kb.insert();

There is on OOB business rule which change the workflow state of KB article as draft before insert. If you make it active false then your UI action will work.

 

GunjanKiratkar_1-1668876253136.png

 

The 2nd method is exclude the KB article created from UI action as below :-

UI action code :-

var kb = new GlideRecord('kb_knowledge');
kb.initialize();
kb.workflow_state = 'review';
kb.short_description = current.short_description;
kb.text = "Article From Outage:"+"\n"+current.details;
kb.insert();

 

BR edit in condition:-

GunjanKiratkar_2-1668876648209.png

 

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

9 REPLIES 9

Mike_R
Kilo Patron
Kilo Patron
var kb = new GlideRecord('kb_knowledge');
kb.initialize();
kb.workflow_state = 'review';
kb.short_description = current.short_description;
kb.text = current.details;
kb.insert();

Uttam Sai
Tera Contributor

Hi @Mike_R ,

The workflow is not getting updated in Knowledge Article form . Could you please help me what else could be done .

Thank you 

Uttam Sai S

Can you post a screenshot of your UI action?
And also a screenshot of the created KB article?

Uttam Sai
Tera Contributor

KB Article.pngUI Action.png