- 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
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
10-07-2019 04:21 AM