- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 03:51 AM
Hi All,
I would like to seek you help on how I can verify that our Knowledge Article will be retired after the valid to date. Will this be OOB in Fuji for Knowledge Management.
Appreciate your help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2015 04:18 AM
Hi,
Use this code-
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('workflow_state','!=','retired');
kb.addQuery('valid_to','<',gs.now().toString());
kb.query();
while(kb.next()){
var workflow = new Workflow();
workflow.cancel(kb); //this will cancel all workflow contexts with the record
kb.workflow_state = 'retired';
kb.update();
}
This should work.
If you are using workflow for knowledge article flow then I would recommend you to use 'Wait for condition' with condition 'valid to at or before Today' followed by 'Set values' activity.
Have a good day
Thanks,
Tanaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 07:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2015 09:53 PM
Thanks for this, Mike! I was also able to reference in our Wiki -- Legacy:Retire Expired Knowledge Base Articles - ServiceNow Wiki
But, when I click on Execute Now, it still does not work. The article remains published. Hope to hear for your usual help and advise. Thank you in advance! Know Your Expert | Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2015 11:20 PM
Hi,
Can you try to reproduce this on any demo instance so that I can take a look.
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 07:59 AM
Can you please check on in the scheduled jobs.the script definetly will be in it. You can also check on "Knowledge email expiraion" scheduled job.why because in some case in the same scheduled job only they will write code for both state change and email notification.
Thanks,
Pardhu Guduru.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2015 09:49 PM
Hi Pardhu, There is currently no OOB for KB in Scheduled Jobs including the one you mentioned.