cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chris66
Frequent Visitor

How to relate all items in a collection or a gallery

I'll try and make this is as clear as I can:

 

1) I have a Gallery that filters Users entity in dataverse. When you select one of these it gets added to a collection: let's call it colSelectedUsers.

2) My Users entity has a many to many relationship with a custom entity: let's call it cz_myentity.

3) I want to relate the selected users that are in the collection colSelectedUsers with a specific record in cz_myentity.

4) The record for cz_myentity is created in my app in an EditForm using the SubmitForm function.

5) The OnSuccess should then relate my selected users.

6) The formula I currently have is:

ForAll(colSelectedUsers, Relate(LookUp(Users, User = ThisRecord.User).'My Entities (cz_myentity_user)', EditForm1.LastSubmit))

 

This doesn't work and gives me the error: "The right side of equal must be a constant value" so I try:

6a) ForAll(colSelectedUsers, Relate(LookUp(Users, 'Primary Email' = ThisRecord.'Primary Email').'My Entities (cz_myentity_user)', EditForm1.LastSubmit))

 

7) It almost works! It actually relates a seemingly random User record in my environment (but always the same one) and that's it...

 

Any help greatfully received.

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Community Champion
Community Champion

@Chris66 Try this,

ForAll(colSelectedUsers, Relate(EditForm1.LastSubmit.Users, ThisRecord))

View solution in original post

3 REPLIES 3
CNT
Community Champion
Community Champion

@Chris66 Try this,

ForAll(colSelectedUsers, Relate(EditForm1.LastSubmit.Users, ThisRecord))

View solution in original post

Chris66
Frequent Visitor

Thanks for the reply. Editing this to say... it works! Thank you!

CNT
Community Champion
Community Champion

@Chris66 Glad it works!

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,676)