var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery('sys_class_name!=kb_knowledge_block^kb_knowledge_base=aea78bff0220b20ffffffffff17^author.u_legal_entity=HRJ'); // PASS your QUERY HERE
//gr.setLimit(); // run for 5 records and then comment this line to run for all records
gr.query();
5
gs.log("Fix Script to update KB:::" + gr.getRowCount());
while (gr.next()) { // cancel old
7
var flows = new Workflow().getRunningFlows(gr);
8
while (flows.next()) {
9
new Workflow().cancelContext(flows);
10
} // attach the new one
var wf1 = new Workflow();
wf1.startFlow(wf1.getWorkflowFromName('Knowledge - Approval Publish'), gr, 'update');
}