Expired articles are visible in global search

seelamnandh
Tera Contributor

Even after the knowledge article’s Valid To date has been passed, the article is still visible to all users in the global search(Native UI). The workflow state of this article is still published, and valid to date is passed

10 REPLIES 10

Its_Azar
Mega Sage

Hi there @seelamnandh 

 

Please verify whether the scheduled job for expiring knowledge articles is running correctly, as the workflow state usually needs to change from Published to Expired/Retired for the article to be removed from search results. Also check search indexing, since stale indexed results can sometimes continue to appear until the index is refreshed.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.

Kind Regards,
Azar
Serivenow Rising Star
Developer @ KPMG.

Hello @Its_Azar , Thanks for the response. There is no scheduled job configured, so i have now configured a scheduled job to change the workflow state from published to outdated, once the valid to date has passed. But even me with knowledge_admin role, not able to see that particular article in global search. I am getting the below error

seelamnandh_0-1778739032711.png

 

Once the article state changes from Published to Outdated, ServiceNow blocks access from Global Search (even for knowledge_admin). Outdated articles should be accessed from the Knowledge article list, not via Global Search.

 

 
If this helped, please mark it as Helpful 👍or Accept Solution ✔️so others can find the answer too.

vaishali231
Kilo Sage

Hey @seelamnandh 

This behavior is expected unless article expiry automation is configured.

The Valid To field alone does not automatically hide or retire a Knowledge Article from Global Search in Native UI. If the article is still:

  1. in Published state
  2. Active = true
  3. and indexed by search

then it can continue appearing in search results even after the Valid To date has passed.

Please verify the following:

  1. Check whether any Knowledge expiry/retirement scheduled job is active.
  2. Confirm whether a Knowledge lifecycle workflow/flow is configured to automatically retire expired articles.
  3. Rebuild or refresh the search index if the article was recently updated.
  4. If using AI Search or custom search sources, ensure expired articles are excluded using conditions like:
valid_toISEMPTY^ORvalid_to>=javascript:gs.nowDateTime()

OOB, the valid_to field is mostly informational and does not automatically change the workflow state to Retired.

As a solution, you can create a Scheduled Script/Flow to retire expired articles automatically.

 Scheduled Script:

var gr = new GlideRecord('kb_knowledge');

gr.addQuery('workflow_state', 'published');

gr.addQuery('valid_to', '<', gs.nowDateTime());

gr.query();

while (gr.next()) {

    gr.workflow_state = 'retired';

    gr.active = false;

    gr.update();

}

 

After retirement, reindex Knowledge Search if the article still appears in Global Search.

****************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

Regards

Vaishali Singh

Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb