How to add dynamic filter in ai search indexed sources

ManikandanP7586
Giga Contributor

How to add dynamic filter like contact.account is dynamic of me in ai search indexed sources if we add it throws an error, how to resolve this?

2 REPLIES 2

Nitish Saini
Tera Expert

Hi @ManikandanP7586 

You cannot add contact.account = me directly into an AI Search Indexed Source filter in ServiceNow, because:

  • Indexed Source filters are evaluated at indexing time.

  • At indexing time, there is no logged-in user context, so me or gs.getUserID() cannot be resolved.

✅ Solution:

  • Do not put the dynamic filter in the Indexed Source.

  • Index all potentially relevant records in the Indexed Source.

  • Apply contact.account = me in the Search Profile or a Scripted Search Source, where filters run at query time and have access to the logged-in user context.
    OR
    If you want to go through Scripted Search Source, please go ahead with below steps:-

    NitishSaini_1-1754974483942.png

     

    Please accept my answer and mark as helpful/correct if it resolves your query.

    Regards, 
    Nitish Saini




Nitish Saini
Tera Expert

Hi @ManikandanP7586 
Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it as accepted and close the thread so that it benefits future readers.