cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

Lookup related records from subgrid in CDS

Hi all

 

I have two custom entities A and B. On my Entity A (products), I have a subrid showing all related components from B (components), that is. On Entity B, I am defining a relationship to records in Entity A.

 

I am building a flow, and I want to be able to retrieve all related components from (B) for a record in A. That is if in A I have product XY, then the product have component 1 and component 2 related to it. How can I manage that? 

 

I have looked into FetchXML but didnt figure it out, and also tried with a Filter on OData but it looks like I am missing something.

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User II
Dual Super User II

Hi @emoii 

 

Can you check what is the relationship between the two entities? Is it N:1 or N:N? 

 

In either case, you can get the related records by using the set name of the relationship entity in the List Records action and then in the filter query pass the name of the entity on which you are getting the record and pass the identifier.

 

E.g., Category and Items are two entities and there is an N:N relationship between the two. The set name of the entity is e.g. new_category_new_itemset and you can use this in the name for the list records action. In the filter query, pass new_category eq 'recordIdentifierFromAPreviousAction' 

 

Ref: https://www.inogic.com/blog/2019/01/retrieve-many-to-many-nn-related-records-in-dynamics-365-using-m...

Ref: https://powerusers.microsoft.com/t5/Building-Flows/Lookup-related-Many-to-Many-N-N-records-using-Flo...

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Dual Super User II
Dual Super User II

Hi @emoii 

 

Can you check what is the relationship between the two entities? Is it N:1 or N:N? 

 

In either case, you can get the related records by using the set name of the relationship entity in the List Records action and then in the filter query pass the name of the entity on which you are getting the record and pass the identifier.

 

E.g., Category and Items are two entities and there is an N:N relationship between the two. The set name of the entity is e.g. new_category_new_itemset and you can use this in the name for the list records action. In the filter query, pass new_category eq 'recordIdentifierFromAPreviousAction' 

 

Ref: https://www.inogic.com/blog/2019/01/retrieve-many-to-many-nn-related-records-in-dynamics-365-using-m...

Ref: https://powerusers.microsoft.com/t5/Building-Flows/Lookup-related-Many-to-Many-N-N-records-using-Flo...

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hi @yashag2255 

 

Thanks, you saved my day. I have been looking into those links you sent me but your post clarified it for me. I was afraid I had to create a new entity, to fix this.

 

It worked with the "set", and now I am able to retrievere the related records.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (86,491)