Issue setting KB article state to Outdated

abhishekrav
Mega Expert

Hi I have recently experienced that few of the previous versions of KB articles are not set to Outdated state.

Due to this users are not able to see Checkout UI action.

Can you suggest how can we move the workflow state to Outdated because i am not able to find the choice as outdated on that field.

3 REPLIES 3

Bhuvan
Kilo Patron

@abhishekrav 

 

Check if you have installed Knowledge Management Advanced Plugin. If not, please install the plugin and try it.

 

To show Outdated knowledge articles in the search results, set property 'glide.knowman.show_unpublished' to true

 

To allow specific roles to allow non-published articles, set property 'glide.knowman.section.view_roles.stagesAndRoles' with roles

 

Refer below knowledge article if you are looking for reporting based on Outdated state

 

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

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@abhishekrav 

 

Below article can help with more information,

 

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

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

KrishnaMohan
Giga Sage

Hi @abhishekrav 

1) I have recently experienced that few of the previous versions of KB articles are not set to Outdated state.

  •  When a new version of a KB article is published, the out-of-the-box (OOTB) behavior in ServiceNow is to set the workflow_state of the previous published version to Outdated. The "Checkout" UI action is designed to only be visible on the most current, published version of an article. When previous versions remain in the "Published" state, it can confuse the system and prevent the "Checkout" button from appearing on the correct article.

2)  Due to this users are not able to see Checkout UI action -

  • Have you installed com.snc.knowledge_advanced plugin. If yes why users are not able to see checkout ui action? did you customize the ui action? or did you verify the ui action condition ?(!(new KBCommon().isStackNameDialog()) && (new KBCommon().isVersioningEnabled()) && (new KBVersioning().canCheckout(current)))?

3) Can you suggest how can we move the workflow state to Outdated because i am not able to find the choice as outdated on that field.  -      

  •    The reason you don't see "Outdated" as a choice on the workflow_state field is because it's not a user-selectable option in the standard workflow. It is a state that is managed by the system's behind-the-scenes logic when article versioning is enabled.

However to move the workflow state to Outdated  you'll need to manually correct the workflow_state for the affected articles. The most effective and recommended way to do this is by using a background script.

Example Background script

var updateArticle = new GlideRecord('kb_knowledge');
updateArticle .addEncodedQuery('workflow_state=published^number=KB0012345^version<3.0'); // Adjust the query based on your requirement.

// Or, if you want to update a specific article by its sys_id:
// var updateArticle = new GlideRecord('kb_knowledge');
// updateArticle .get('sys_id_of_the_old_article');

updateArticle .query();
while (updateArticle .next()) {
    // Set the workflow_state to 'Outdated'
    updateArticle .workflow_state = 'outdated';
    updateArticle .setWorkflow(false);
    updateArticle .update();
}

 

Check Article to know more about article versing in ServiceNow

 

If this helped to answer your query, please mark it helpful & accept the solution.
Thanks!
Krishnamohan