So I have an API GET that looks like the following:
https://company.crm.dynamics.com/api/data/v9.0/accounts?$select=accountid,accountnumber,name&$expand=account_productbuyer($select=productbuyerid,status)&$filter=status code eq 1
I'd like to only return records in the expand from the account_productbuyer where the status equals a certain value. I've tried adding filter into the expand, but it is the incorrect syntax.
Is this possible to do via the web API? I'm trying to avoid iterating through the records returned in the expand to check for a certain status value.
Hello,
I am facing the same problem i'm trying to add a filter on a field on an expanded entity , i tried your example abouve but i'm getting the following error:
xxxxxxxx/.../accounts eq 1;$select=contactid)
Only $select clause can be provided while doing a $expand on entitysets
That did the trick. Thanks for the help!
Hi partner,
You could try this url:
company.crm.dynamics.com/.../accounts$filter=statuscode eq 1&;$select=productbuyerid,statuscode)
You need to put the condition "statuscode" in the expand.For examle, I tried to search for the contacts from account entity with statuscode = 1,and here are my url and response.
You could also refer to this doc for more detals about how to use expand.
Hope it helps.
Best Regards,
Leo
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156