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

Dave Smith1
ServiceNow Employee
ServiceNow Employee

Not sure what you mean by "run the instant publish" but if you mean "can draft articles be moved to published" then yes. It's the "Publish" button, usually located top-right.



However, in terms of organisational procedures - if the articles have been vetted by the knowledge team, surely it's up to them to publish them...?



What workflow is on your KB at the moment - is it "Approval Publish" or "Instant Publish"...?


Dave,



Thank you for the response. What happened was, the articles were all being created an input manually over the last few weeks and the workflow was set to Approval Publish. Now we've got 300+ articles that are sitting in a draft state that we need to get to a published state. I was hoping to be able to change the workflow settings to instant publish and force that to run against all the current draft state articles. If that makes sense?


Ben Hughey wrote:



Thank you for the response. What happened was, the articles were all being created an input manually over the last few weeks and the workflow was set to Approval Publish. Now we've got 300+ articles that are sitting in a draft state that we need to get to a published state. I was hoping to be able to change the workflow settings to instant publish and force that to run against all the current draft state articles. If that makes sense?


Note that they'll still be sitting in draft state until someone hits the Publish button. Approval Publish simply means once someone hits the "published" button, it moves into a "Review" state that requires approval to continue onto visibility.



So, once changing the workflow to Instant Publish you've got two approaches here:


  1. if the articles are still in draft, have your knowledge team click the "publish" button to make them visible.
  2. if the articles are still in review, have a Knowledge Manager for that KB (i.e.: someone with knowledge_manager role) mass-approve the outstanding 300+ articles (which is what I think you're after).


You may also want to review and discuss your knowledge management process with the knowledge team and formalise the process/policy with them.


Dave,



Thank you for taking the time as well.



What I'm trying to do is get all 300 articles from Draft to Published without having to manually click each one. It sounds like that's not an option though!



We have reviewed our policies and process around this going forward but that doesn't fix what's already happened!



Ben-