Default valid_to needs to remain as original, when checkout article
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 11:55 AM
When a KM or Author a KB article checkout an article to update, the valid to date changes and gets extended by one year.
I know this happen because of KBCommon
But is required the other functionalities still/remains.
For example such as 2100 and default as KBase Validity (FOR FIRST TIME).
I mean:
The valid to date must remain the same as before/Preserve the same date when manager or author checkout for some updates.
How can we complete the script include to add his exception without disable all others features?
If I disable KBCommon ScriptInclude in the default dictionary value for valid_to field we lose the others features.
Thanks
KBCommon Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 12:50 PM
Hi Leandro,
the KBCommon script include is meant to be able to alter behavior of the KBCommonSNC script include. You can override a function in KBCommonSNC by coping the function there to the KBCommon script include, and make a change. That will not affect any other functionality in KBCommonSNC. KBCommon extends KBCommonSNC OOB and is empty in my instance. And it seems the following code is what is responsible for updating the 'valid_to' value.
isDefaultValidToSet: function(){
return new GlideRecord("kb_knowledge").getElement("valid_to").getED().getDefault() == "javascript: current.kb_knowledge_base ? new global.KBCommon().getDefaultValidToDateFromCurrentDate(current.kb_knowledge_base) : '';";
},
So you only need to include that function in KBCommon, make a change to alter that behavior as you desire. It will not cause a loss of any other feature in the KBCommonSNC script include.
But then you may want to alter scripts that call that method if you find 'valid_to' is not set as desired in certain scenarios.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 02:10 PM
Hello Bert
Exactly that info is what I know. Even more, I've already tried using KBCommon.
What I need is how to code, or alter the code for achieve the following:
I don't want to disable directly all functions about that script include.
That script include set valid to 2100 if validity is empty.
That script include also set one period previously have set on validity every time the article was check out.
I want to add this function:
The valid to date must remain the same as before/Preserve the same date when manager or author checkout for some updates.
Maybe creating another if condition..?
Any snip code to add?
How can we complete the script include to add this exception without disable all others features?
Thanks Bert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 02:21 PM
Or maybe adding some in Client Script "Change Default Article Validity Date"
I mean, for example adding another else if
for add this function:
The valid to date must remain the same as before/Preserve the same date when manager or author checkout for some updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 03:45 PM
Hi LeanPach,
Try a Business rule on the table, with Order = 1000. Runs on Update and to set the field value to 'previous.valid_to'. Script would have: current.valid_to = previous.valid_to; (Advanced must be checked to access the script.)