0

I want to get the Approver(people field) value from list item using REST API where Country(lookup field) equals to 'ABC' and Cluster(lookup field) is equals to 'XYZ'

I have written below REST API it does not returning any result.

siteurl/_api/Web/Lists/GetByTitle('Approvers')/items?$expand=Approver,Country,Cluster&$select=Approver/Id,Approver/Title,Country/Id,Country/Title,Cluster/Id,Cluster/Title&$filter=Country eq 'ABC'

NOTE: If i hit same url without filter then i get result But it only showing Approver details not country and cluster field details.

Please help. Any help will be really appreciated. Thank you.

1

When you add a lookup field to a list in SharePoint, you can't filter by the name of the item in the lookup column. You will have to filter it using ID.

Refer below URL. This will work for you:

siteurl/_api/Web/Lists/GetByTitle('Approvers')/items?$expand=Approver,Country,Cluster&$select=Approver/Id,Approver/Title,Country/Id,Country/Title,Cluster/Id,Cluster/Title&$filter=CountryId eq 'ABC'

OR

siteurl/_api/Web/Lists/GetByTitle('Approvers')/items?$expand=Approver,Country,Cluster&$select=Approver/Id,Approver/Title,Country/Id,Country/Title,Cluster/Id,Cluster/Title&$filter=Country/Id eq 'ABC'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.