cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
D365_Eric
Helper V
Helper V

How to filter rows with lookup column in Dataverse

Hello Community,

 

I have been trying to figure out how to set the filter query in the List Rows action in Dataverse, to only get the related records from the same parent lookup. As an example, for each Account, we have multiple child Contacts associated with the same parent account record (i.e. having the account as the lookup on the contact).

 

In the Power Automate flow, I use the List Rows action to first get all the accounts in Dataverse, and then use "Apply to each" operation to loop through each account. For each loop, I want to use the List Rows action to get all the related contact records associated with the same account via the account lookup. How can I define that filter query so that the List Rows action in each loop returns only the list of related contacts for the same account lookup, as we loop through each account?

 

D365_Eric_1-1655358197696.png

Any insights would be greatly appreciated!

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Rose2022
New Member

You should use _parentcustomerid_value which holds a numerical value of the accountid. Hope it works! 

View solution in original post

5 REPLIES 5
StretchFredrik
Super User
Super User

{ColumnName} eq '{YourDynamicData}'

Hi @StretchFredrik ,

 

Thanks for your reply. I tried the following, however it's not working. It gives me the following error:

 

Did I miss anything in terms of syntax?

D365_Eric_0-1655382090844.png

D365_Eric_1-1655382178428.png

 

StretchFredrik
Super User
Super User

The column doest exist, are you taking the "backend" name of the column? I usually get this by looking at the API call and seeing what the internal name for the field is. 

Hi @StretchFredrik ,

 

Yes, in this case, in the filter condition, I am putting parentcustomerid eq 'Account' (Account being the Dynamic Data). The field "parentcustomerid" is the out of the box internal name of the lookup field to Account on the Contact entity. Not sure why it's complaining the field doesn't exist because it's definitely there... 

Rose2022
New Member

You should use _parentcustomerid_value which holds a numerical value of the accountid. Hope it works! 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,635)