- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 01:26 PM
Hi Guys,
I need to overwrite the default Valid to date in the KB article. OOB, when you check out an article, automatically it sets it to 2100-01-01.
I need to keep the current Valid to date if it's greater than today's date and not update it to 2100-01-01.
Thank you in advance.
Regards,
Jocelyn
Solved! Go to Solution.
- Labels:
-
Knowledge Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 01:04 AM
Hello,
You can also set the Article Validity on the Knowledge for a certain amount of days after publishing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 01:36 PM
Hello,
Can you give more information?
When creating an article the default date is 01/01/2100.
You said:
"I need to keep the current Valid to date if it's greater than today's date"...but this default date is only set to that 2100 year, etc. on new records, otherwise you change it yourself, save, and then that's it...it's changed. But again, the default date is greater than today's date...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 02:45 PM
Hi Allen,
Thanks for replying to my email. I updated the Checkout UI action. I added the lines in red.
If the valid to date is in the future do not update to 2100-01-01
// TODO Move the messages to messages table
var gd = new GlideDate();
var toDate = (gd.getDisplayValueInternal());
var recordClass = current.sys_class_name;
var previous_valid_to = current.getDisplayValue("valid_to");
var newRecord = new KBVersioning().checkout(current);
if (newRecord) {
if (recordClass == 'kb_knowledge_block')
gs.addInfoMessage(gs.getMessage("A new version of the block is created for revision."));
else
gs.addInfoMessage(gs.getMessage("A new version of the article is created for revision."));
var current_valid_to = newRecord.getDisplayValue("valid_to");
if (previous_valid_to > toDate) {
gs.log('The current valid date is in the future, do not update - ' + previous_valid_to);
current_valid_to = previous_valid_to;
current.valid_to = previous_valid_to;
newRecord.valid_to = previous_valid_to;
}
if (previous_valid_to != current_valid_to) {
if (gs.nil(previous_valid_to))
gs.addInfoMessage(gs.getMessage("Valid to has been changed to {0}.", current_valid_to));
else
gs.addInfoMessage(gs.getMessage("Valid to has been changed from {0} to {1}.", [previous_valid_to, current_valid_to]));
}
action.setRedirectURL(newRecord);
} else
gs.addErrorMessage(gs.getMessage("You cannot checkout this article as it is already checked out."));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 01:38 PM
Please take a look at below:
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2020 02:47 PM
Hi Prateek,
Thanks for your reply. Dynamic Default Value is not working. It still goes back to 2100-01-01.
Regards,
Jocelyn