cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

Re: Lookup related records from subgrid in CDS

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
Highlighted
Dual Super User III
Dual Super User III

Re: Lookup related records from subgrid in CDS

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

Highlighted
Resolver I
Resolver I

Re: Lookup related records from subgrid in CDS

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Users online (6,459)