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

Select Multiple values from Lookup on Power Apps Portal

Hello Community Experts!

I am stuck with a requirement where I need to select Multiple Values from a lookup. I have an entity A with values which is rendered as a lookup in an entity B. I want to select multiple values from this lookup field on the entity form of the Entity B and store these multiple values on the Entity View of entity B. Could anyone please suggest me how this can be achieved?

Your help is greatly appreciated!

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Supplier
Solution Supplier

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @PowerappsUser06,

Do you also need to maintain the N:N relationship - in other words, what is the data used for? Do you only need to make Entity A your options and don't care about associating the two?

You can consider the following:

  1. Change Entity A to a "Multi-Select Option Set" and use in the Portal as @gisingh has linked - note that I'm not a fan of the approach used here, as it will require extensive JavaScript, C#, etc. and I'll be writing my own blog post on how to do it if requirements are simpler
  2. Use Entity A as a list of options, retrieve them and put the selected values as a comma-separated list in a string of Entity B but have no real association
  3. Create an intersect table that connects N Entity A to N Entity B and build a Power Automate (Flow) to update the Entity B with a string list of the Entity A every time one of these records are created/updated/deleted

Having Entity A as an entity poses some concerns you should consider:

  • Will records be created/updated often? If no, then an Entity is not the best choice
  • Will you need to be able to retire values and maintain relationships or dates of their validity/lifespan? If no, then an Entity is not the best choice
  • If an option of Entity A is "listed" in existing Entity B, but you change the name of Entity A, does Entity B need to show the original name? If no, most of your options will have increased technical debt to update existing records

View solution in original post

8 REPLIES 8
Highlighted
Solution Supplier
Solution Supplier

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @PowerappsUser06,

You will need to change the relationship from a Many-To-One (Entity A to Entity B) to a Many-to-Many. This can't be changed outright, you will need to create an additional relationship. After, you will have subgrids on both entities (Grid of Entity A on Entity B, grid of Entity B on Entity A).

Add relationship:

justinburch_0-1599585370295.png

"Many Contacts can be associated to many (multiple) Accounts":

justinburch_1-1599585423415.png

"Learn more": https://go.microsoft.com/fwlink/?linkid=869761

 

 

Highlighted
Frequent Visitor

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @justinburch ,

Thanks for the reply! Could you please suggest how I can display the Many-to-many relationship on the entity form so that on submitting the entity form, the entity list gets updated with multiple values? I want to select multiple values from another entity on the Entity B in the Portal.. Could you please help me on this?

Thanks in advance!

Highlighted
Solution Supplier
Solution Supplier

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @PowerappsUser06,

  1. On Entity A, go to Relationships
    justinburch_0-1599633227604.png
  2. Add a Many-to-Many for Entity B
    justinburch_1-1599633243476.png
    justinburch_2-1599633337018.png
  3. Save Entity to publish the relationship
  4. Go to the form for Entity B
  5. OPTIONAL: Use the dropdown next to Save to "Save as" and name it "Portal Form" to keep separate
    justinburch_3-1599633591390.png

     

  6. Switch to components on the left nav bar
    justinburch_4-1599633632631.png

     

  7. In Related Data, choose Subgrid
    justinburch_5-1599633647873.png

     

  8. Enable "Show related records" and choose Entity A (OPTIONAL: create a view specific for this subgrid if you want - this will control what fields the user sees in their list)
    justinburch_6-1599633693093.png

     

  9. OPTIONAL: Change the subgrid name to something that makes sense, like "EntityAList"
  10. Save and Publish the form
  11. Navigate to Entity Forms for Portal
  12. Use the appropriate form if changed to Portal form before
  13. Navigate to Entity Form Metadata tab, + New
    justinburch_7-1599633974198.png

     

  14. Type: Subgrid
  15. Subgrid Name (will pop up after type selected): [Select name of subgrid before]
  16. Grid Configurations (will pop up after grid selected):
    • Add "Associate" if Entity A records are already created
      • Change button label if you want, such as "Select Options"
    • Add "Create" if Entity A records can be created by Portal users also
      justinburch_8-1599634198667.png

       

  17. OPTIONAL: Have a view created for Entity A - this will be the view that the user sees while searching for records to add/create
  18. Users should have appropriate Append & Append To Entity Permissions for both Entity A and Entity B
    e.g. justinburch_11-1599634603867.png

     

  19. Refresh the cache (portalurl/_services/about while logged in a Administrator) to make changes appear more quickly

Page in Portal:

justinburch_9-1599634456896.png

Clicking "Associate"/"Select Options"/etc.

justinburch_10-1599634476134.png

Selecting odd number Tests

justinburch_12-1599634665234.png

 

Highlighted
Microsoft
Microsoft

Re: Select Multiple values from Lookup on Power Apps Portal

Highlighted
Frequent Visitor

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @justinburch ,

I want to display the selected options from the subgrid on the Entity View of Entity B. I am able to display Selected option on the entity form of Entity B. But How can I display the selected option on its Entity View after submitting the form? Could you please suggest?

Thanks a lot for your help!

Highlighted
Solution Supplier
Solution Supplier

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @PowerappsUser06,

 

You want to show the selected Entity A options in a view of Entity B records (example below)? That won't be possible. You will need to write custom logic to store all of the associated Entity A records in a text field, and also custom logic to remove values when the association is broken, records are deactivated, etc. It will be difficult to manage and I would recommend considering alternative approaches, if possible.

Entity B RecordOwnerEntity A Records
Test AJustinTest 1, Test 3
Test BChrisTest 4
Test CJohnTest 2, Test 3, Test 4, Test 5
Test DDavidTest 3, Test 5

 

Highlighted
Frequent Visitor

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @justinburch 

Yes I need something as you have shown in the image above.. I do not have any ideas on how I can achieve that.. I have just started off with Power Apps. Do you have any suggestions on what approach I can go for?

Thanks a lot for your help!

Highlighted
Solution Supplier
Solution Supplier

Re: Select Multiple values from Lookup on Power Apps Portal

Hi @PowerappsUser06,

Do you also need to maintain the N:N relationship - in other words, what is the data used for? Do you only need to make Entity A your options and don't care about associating the two?

You can consider the following:

  1. Change Entity A to a "Multi-Select Option Set" and use in the Portal as @gisingh has linked - note that I'm not a fan of the approach used here, as it will require extensive JavaScript, C#, etc. and I'll be writing my own blog post on how to do it if requirements are simpler
  2. Use Entity A as a list of options, retrieve them and put the selected values as a comma-separated list in a string of Entity B but have no real association
  3. Create an intersect table that connects N Entity A to N Entity B and build a Power Automate (Flow) to update the Entity B with a string list of the Entity A every time one of these records are created/updated/deleted

Having Entity A as an entity poses some concerns you should consider:

  • Will records be created/updated often? If no, then an Entity is not the best choice
  • Will you need to be able to retire values and maintain relationships or dates of their validity/lifespan? If no, then an Entity is not the best choice
  • If an option of Entity A is "listed" in existing Entity B, but you change the name of Entity A, does Entity B need to show the original name? If no, most of your options will have increased technical debt to update existing records

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

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

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.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (7,711)