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
Super User
Super User

@Chris66 Try this,

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

View solution in original post

3 REPLIES 3
CNT
Super User
Super User

@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!

@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.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,462)