- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 04:46 AM
Hi,
knowledge article in system has passed the valid to date but workflow is still showing published. Ideally it should move to Retire but it is not happening. There is no way to check workflow execution for that kb article. Please let me know if anyone knows why is this happening. PFB screenshot for reference.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 05:09 AM - edited 01-05-2024 05:10 AM
Hi @Sarabjeet1,
Here's a script you can use in a Scheduled Job.
Please mark correct and helpful.
Thanks,
Robbie
var retireKB = new GlideRecord('kb_knowledge');
retireKB.addEncodedQuery("workflow_state=published^retired<javascript:gs.daysAgoStart(0)"); //change 0 to the number of days ago
retireKB.query();
while(retireKB.next()) {
retireKB.workflow_state ='retired';
retireKB.active=false;
retireKB.update();
retireKB.log('Knowledge article retired' +retireKB.number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 04:52 AM
Hi @Sarabjeet1
Knowledge article validity is the date a knowledge article expires. Articles do not appear in search results after the Valid to date or if the Valid to date is blank
Its expire not Retired.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 04:57 AM
Hi Atul,
Thanks for your quick response. could you please let me know if i have to retire it manually each time as there is no approval attached to this expired article or how will this proceed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 05:02 AM
Hi @Sarabjeet1
You can retire the articles manually by clicking the UI action and if any notification mapped it will trigger or check the knowledge base Retire Workflow.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 05:09 AM - edited 01-05-2024 05:10 AM
Hi @Sarabjeet1,
Here's a script you can use in a Scheduled Job.
Please mark correct and helpful.
Thanks,
Robbie
var retireKB = new GlideRecord('kb_knowledge');
retireKB.addEncodedQuery("workflow_state=published^retired<javascript:gs.daysAgoStart(0)"); //change 0 to the number of days ago
retireKB.query();
while(retireKB.next()) {
retireKB.workflow_state ='retired';
retireKB.active=false;
retireKB.update();
retireKB.log('Knowledge article retired' +retireKB.number);
}