Can I run the instant publish on articles in draft state?

bjhughey164
Mega Expert

Can I run the instant publish on articles already in draft state?

The articles have been created and vetted by our Knowledge team so I just need to move them to a published state. Is this possible?

1 ACCEPTED SOLUTION

Okay, this is hastily knocked up, and seems to work on articles that are currently draft but NOT "review":



(edited - <pre> tags barfed)



gs.log("1. Starting 'update-kb' script","UPDATE-KB");



gs.setSession.setStrictQuery(true);



// -- first, we use a GlideRecord against the Knowledgebase table


var pending = new GlideRecord('kb_knowledge');



// -- create our query:


pending.addEncodedQuery('workflow_state=draft^ORworkflow_state=review');



// -- call that query:


pending.query();



gs.log("2. found " + pending.getRowCount() + " records to update.","UPDATE-KB");



// -- now update each record found:


while(pending.next())


{


      // -- flick workflow state over


      gs.log("3. changing: " + pending.number + " to PUBLISHED.","UPDATE-KB");


      pending.workflow_state = 'published';


      pending.update();


}



gs.log("4. Completed script","UPDATE-KB");



This should write out to your script log, but under a different "source" so it should identify the records that have been amended, should you need an audit trail.   I trust you'll run it on a testbed first!


View solution in original post

16 REPLIES 16

Ahh, so I can edit the action on selected rows button to include "publish" you're saying? Sounds viable.


naveen reddy2
Tera Contributor

Publish "Draft" and "Review" state articles:
Currently there are 877 KB articles persist in our service now repository. In total, 486 KB articles are in "Draft" and "Review" state, which are created from problem as a source task. These KB articles should be published. Currently there are few difficulties to chase each KB authors to publish from their end. So, requesting service now team to publish it from backend. in the approval stage no longer required