Search code examples
httphttpsservicenow

How to filter the records in URL based on the values present inside them?


I Have three fields parent,type,child. How do i filter the records inside the field "type" in URL. for example there is one value inside "type" field called "Used By" and i want only records with the type "Used by".

i am trying with the below method

&sysparm_query=typeISUsed%20by

doing this i am getting huge records with all the types.instead of filtering only "Used by" type

and also how do i combine if i want to filter multiple record value like "Used by", "Depends On", "Managed by","Connected by".


Solution

  • I got the solution with this following method below.

    For Each relationship type inside ServiceNow, There is a SYS ID. for example i have two SYS ID's 1a9cb166f1571100a92eb60da2bce5c5 and 60bc4e22c0a8010e01f074cbe6bd73c3

    By putting sysparm_query=type=1a9cb166f1571100a92eb60da2bce5c5^ORtype=60bc4e22c0a8010e01f074cbe6bd73c3 inside the URL, i was able to combine the filters and get records only related to these SYS ID's.

    Another easy method is first put a filters in Service now for all the relationship types. Then copy the query URL and append "sysparm_query=" to the URL.