Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

automatic publishing

JulietChicago
Tera Guru

We have knowledge article that come in via an integration in the Draft state. We want the articles to be published automatically without a person having to select the "published" button. How can we do this?

 

 

1 REPLY 1

SatyakiBose
Mega Sage

Hello @JulietChicago 

You can run this script in background or as a schedule job to bulk publish KB articles.

gs.log("1. Starting 'update-kb' script","UPDATE-KB");
gs.setSession.setStrictQuery(true);
var pending = new GlideRecord('kb_knowledge');
pending.addEncodedQuery('workflow_state=draft^ORworkflow_state=review');
pending.query();
gs.log("2. found " + pending.getRowCount() + " records to update.","UPDATE-KB");
while(pending.next())
{
      gs.log("3. changing: " + pending.number + " to PUBLISHED.","UPDATE-KB");
      pending.workflow_state = 'published';
      pending.update();
}
gs.log("4. Completed script","UPDATE-KB");