Default valid_to needs to remain as original, when checkout article

LeanNow
Tera Contributor

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

 

 

18 REPLIES 18

LeanNow
Tera Contributor

there isnt any value that I know I have to denied or not allow. The porblem is if I set that BR it doesn't allow manually update of he field valid to. and if in the future they want to update that is not possible. Becasue the business rule take the previous valid to and set in valid to as currrent. And it odenst allow update the valid to date manually.

We achive the first goal. Stops the automatic update. But we need to have the hability to do it manually if we want or need.

Hi LeanPach,

 

You can add whatever logic you want to the BR script. Check current user group membership, and if a member of 'knowledge_admin' (or any other group) just return as I have logic to check 'isInteractive()'.  You never post test results of the approaches described here. Good luck on achieving your goals.

Hi LeanPach,

 

I tried a BR, and it won't work. The value entered on the form remains even though it far in the future.  some interesting related information:

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0777724

 

https://docs.servicenow.com/bundle/utah-servicenow-platform/page/product/knowledge-management/concep...

 

Seems you will need to override the default value for valid_to as it is:

 

javascript: current.kb_knowledge_base ? new global.KBCommon().getDefaultValidToDateFromCurrentDate(current.kb_knowledge_base) : '';

 

if you don't like that behavior.

 

You can also right a Scheduled job to change any values on kb_knowledge that you fee are too far in the future. Or update those manually.

LeanNow
Tera Contributor

Yes, the default value: javascript: current.kb_knowledge_base ? new global.KBCommon().getDefaultValidToDateFromCurrentDate(current.kb_knowledge_base) : '';

Is what I was talking about KBCommonscript inlcude



SOme behaviors desired but automatic change not.

ANd yes the BR wont alow us in the future to change valid to meanwhile is active.

For the same reasoI was thinking in left a "window" open to do that.

 

maybe a condition, for allowing change manually. and restrict automatic aupdate from KBCommon.

Thnaks fro your opinion. 
But I dont need to reestric to any member or something. only allow to idt manually and restrict and maintain previous valid to date.

I'm done here, from one of the links I posted:

 

Default article validity when creating a knowledge article

The default value of the Valid to field is derived from the Article Validity field configured for the knowledge base (see Create a knowledge base). The Valid to date starts from the date the article was created until the number of days specified in the Article Validity field. If the Article Validity field is blank, the default date in the Valid to field for the knowledge article is set to January 1, 2100.

 

I have no idea why you can't set the 'valid_to' value to anything you want. At the top of the link there is:

 

"Knowledge article validity is the date a knowledge article expires and is no longer available to the users. Articles do not appear in search results after the Valid to date or if the Valid to date is blank.

Decide when to expire a knowledge article by using the Valid to field in the Knowledge form. The Knowledge form is available when creating or editing a knowledge article.

When you create or edit a knowledge article, a default value appears in the Valid to field. As an article author or editor, you can select whether to keep or change the default Valid to date."

 

Again, good luck.