Lookup filtering in PowerApps vs Web API vs OData
Views (2615)
When I saw this question in Stack Overflow, I realized it should be easily solved because the lookup will be filtered using either lookup property or its single valued navigation property basically. Only thing is this is related to Canvas PowerApps.
I will take each case & explain it.
OData:
Let’s take this example of filtering Guid in oData query. We have to use either one of below options:
Or
Web Api:
When you want to filter the lookup in web api then use this approach. Refer the below snippet:
I will take each case & explain it.
OData:
Let’s take this example of filtering Guid in oData query. We have to use either one of below options:
"$select=Subject&$filter=RegardingObjectId/Id eq (guid'" + record_guid + "')"
Or
"$select=Subject&$filter=RegardingObjectID eq " + record_guid
Web Api:
When you want to filter the lookup in web api then use this approach. Refer the below snippet:
GET [Organization URI]/api/data/v9.1/accounts?$select=name&$filter=_parentaccountid_value eq <record_guid>
Alternate version:
GET [Organization URI]/api/data/v9.1/accounts?$select=name&$filter=parentaccountid/accountid eq <record_guid>
PowerApps (Canvas app):
Similar to web api, Canvas app gallery will use the filter like explained here. This will use the following snippet to filter it:
Filter('Contacts', _accountid_value = GUID("record_guid"))
This was originally posted here.
*This post is locked for comments