Script to update stage of a KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 01:22 AM
Hi experts,
we have a KB article that is stuck in pending retirement stage. Hi team suggested us to use background script to update the stage to published.
But script is not working for this particular article. Could you please share the fix script or background script.
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:17 AM
Hi @si21 ,
I do not see any issues with the script you are using, I tried using the same script in my PDI and I was able to update the KB state as well. If possible can you please share the screenshot of the error which you are receiving ?
var gr = new GlideRecord("kb_knowledge");
gr.addQuery("sys_id","53e0c9b1474321009db4b5b08b9a71fd");
gr.query();
if(gr.next()){
gs.print(gr.number);
gr.workflow_state="published";
gr.update();
}
Please find the screenshot of the execution attached.
Please mark my answer "Helpful" if you feel that it has helped you in any way.
Thanks and Regards,
K. Sai Charan
Sr. ServiceNow Developer
Deloitte India
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:27 AM
Hi @si21 ,
Please go through this link - https://www.servicenow.com/community/knowledge-managers/articles-stuck-in-pending-retirement/m-p/305... and check if you have a similar issue. If so please follow the below steps:
- Retire the latest published article.
- Re-publish the retired article from earlier step
These steps should help in retiring the article which was in pending retirement state.
Please mark my answer "Helpful" and mark this as "Correct" if you feel that it has helped you in any way.
Thanks and Regards,
K. Sai Charan
Sr. ServiceNow Developer
Deloitte India