We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

automatic publishing

JulietChicago
Kilo Sage

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");