- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 06:15 AM
Hello,
I need to update the field valid_to from the knowledge form based on the following conditions:
1. When the article is published, then the "valid_to field of the article must be extended by 'one year' from the date of publication of the article.
2. If the Article is Rejected(kb will return to draft state), then the "valid_to" should be populated with the latest sys_update_on value.
3. If the Article is in state draft, review or waiting for approval the "valid_to" should be populated with the latest sys_update_on value.
What is the best approach to do this?
Thanks,
Alex
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 06:50 AM
Write a before business rule with condition as
and script:
var gdt = new GlideDateTime();
if(current.workflow_state == 'published'){
gdt.addYearsUTC(1);
current.valid_to = gdt.getDate();
}
else if(current.workflow_state == 'draft' || current.workflow_state == 'review' ){ // Add more states if needed
current.valid_to = gdt.getDate();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 02:16 PM
I am having trouble with this one.
I have created the business rule as such.
Table: kb_knowledge
When To Run:
When: Test both before and after (Insert and Update both checked)
Condition Workflow changes
Nothing in Actions
Advanced:
var gdt = new GlideDateTime();
if(current.workflow_state == 'published'){
gdt.addYearsUTC(1);
current.valid_to = gdt.getDate();
}
else if(current.workflow_state == 'draft' || current.workflow_state == 'review' ){ // Add more states if needed
current.valid_to = gdt.getDate();
}
I am really only needing to have the Valid To date automatically set to 1 year out from published and/or updated on.
However, this never triggers and my valid to stays where ever it is at the moment despite updating and changing published field.
Please help and thank you.
-Mark Mullens