Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Create Dynamic Filter on Requested Item for specific criteria of Requested Item

Hetal2
Tera Expert

Hi team

I have a requirement where I need to filter requested items based on certain criteria 

For capturing the logic of criteria, i have created a script include which returns all the sys_ids of requested item matching criteria 

Now the dynamic filter i create using above script can be used for a record which is referencing requested item e.g. All catalog tasks where requested item match the dynamic filter created

But I want to use the filter on Requested Item itself.

 

How can i use the dynamic filter on sys_id of requested item so that i can get the list

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Hetal2 

call that script include directly in condition builder

Create your own Dynamic Filters 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

drbob
Giga Guru

Just to make sure I understand...

 

You've created a script include (say "mySI") with a function in it (say "mySysIDList") that returns a comma separated list of sys_ids....

sys_id1,sys_id2,sys_id2,...,sys_idn

You're using that in a field somewhere with this syntax:

 

javascript: new mySI().mySysIDList()

 

Now you want to go to sc_req_it_list.do and filter it with the same list ?


If so then I think the answer is dynamic filters (like when you put "assigned to is me" ...but I need to test it to see.

drbob
Giga Guru

As an aside, I can't get that to say javascript followed by a colon character, it keeps getting HTML escaped - I'll google it later to see if I can fix that.

drbob
Giga Guru

Hetal,

Apologies I missed the last line of your original post - you knew it was dynamic filters.


Ankur,

 

Our posts crossed so I didn't see your link - that looks like a great article. I had tried working it out myself and am just not seeing the dynamic option in the filter (I think I got my scopes messed up) so I'll go through that and see what I missed.