Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Incident Related Search

KRISHNACHAR0083
Tera Contributor

User is working on incident and he is trying to attach the knowledge articles which is related that incident issue. User having read access to that article. But here the problem is when the user trying to attach the knowledge article by using Related Search in the incident form, he is not getting that article. At the same another article which is similar to previous one, he can able to get in the Related Search.

 

Example:

1. Kb123456 able to get

2. Kb326182 not able to get 

 

He is getting error message as no matching results found for kb326182

 

8 REPLIES 8

Tanushree Maiti
Tera Patron

Hi @KRISHNACHAR0083 

 

Please try the solution given in this post.

https://www.servicenow.com/community/developer-forum/related-search-results-not-showing-all-knowledg...

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

KRISHNACHAR0083
Tera Contributor

No I have checked the contextual search filters. Everything is fine.

prajaktakha
Tera Expert

Hello @KRISHNACHAR0083 ,

 

The issue may be related to the Active field of the Knowledge Article.

Even if the Knowledge Article is in Published state, it may not appear in the Related Search on the Incident form if the article is marked as Active = false.

For example:

  • KB123456 → Published + Active = true → Appears in Related Search
  • KB326182 → Published + Active = false → Does not appear in Related Search

Solution

First, verify the Knowledge Article record and check:

  • Workflow State = Published
  • Active = true
  • The user has the required read access to the article

If the article is Published but inactive, activate it and then try the Related Search again.

If required, you can activate the article from Background Scripts.

 

Background Script

Go to:

System Definition → Scripts - Background

Use the following script:

var kb = new GlideRecord('kb_knowledge');
kb.addQuery('number', 'KB326182');
kb.query();

if (kb.next()) {
    gs.info('Article: ' + kb.number);
    gs.info('Before - State: ' + kb.workflow_state);
    gs.info('Before - Active: ' + kb.active);

    kb.active = true;
    kb.update();

    gs.info('Article ' + kb.number + ' has been activated.');
    gs.info('After - Active: ' + kb.active);
} else {
    gs.info('Knowledge Article KB326182 not found.');
}

After running the script, verify that:

KB326182 → Active = true

Then refresh the Incident form and search for the article again using Related Search.

If you found this as helpful please accept the solution and mark it as helpful.

 

Regards,

Prajakta