Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How do we add OR condition to REST API URL?

Rajanmehta
Mega Guru

Hello,

I need some help in creating REST API URL with OR condition.

e.g. Assigned Group = A OR Assigned Group = B   OR Assigned Group = C

https://xxx.service-now.com/api/now/table/change_request?sysparm_query=assignment_group='A'

https://xxx.service-now.com/api/now/table/change_request?sysparm_query=assignment_group='B'  

https://xxx.service-now.com/api/now/table/change_request?sysparm_query=assignment_group='C'  

How can I use OR condition to get all groups in one call? They work good individually.

Appreciate your help.

Thanks,

1 ACCEPTED SOLUTION

Bharath40
Giga Guru

Hi,



Select the groups and copy the query, your query should look something like below


https://xxx.service-now.com/api/now/table/change_request?sysparm_query=assignment_group=A^ORassignme...


View solution in original post

2 REPLIES 2

Bharath40
Giga Guru

Hi,



Select the groups and copy the query, your query should look something like below


https://xxx.service-now.com/api/now/table/change_request?sysparm_query=assignment_group=A^ORassignme...


Hi Bharath,



Excellent solution. Right on target.



This really helped me to fulfill my requirements.



Thank you so much,



Rajan Mehta