web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multi select CDS looku...
Power Apps
Answered

Multi select CDS lookup field on edit form only retaining one value when submitted

(0) ShareShare
ReportReport
Posted on by 6

I have an edit form showing records selected from a gallery. One of the edit form fields is a lookup field with selectmultiple set to 'true'. The field is also filtering lookup values based on a combo box selection, this works fine. 

 

Filter(Benefits,'Associated Project'.'Project Name'= ProjectSelectionComboBox.Selected.'Project Name')

 

When a user selects more than one value from this field, and submits the form, only one value is retained\saved. Even after refreshing data sources and reopening the edit form, it only ever shows one value.

 

I simply cannot figure this out....

 

 

 

 

I have the same question (0)
  • CU01081947-0 Profile Picture
    716 on at

    Hello @RMcQueen.

    I hope you're well. I'm being a bit thick here, and can't exactly work out what you're doing, sorry. You say, "When a user selects more than one value from this field", what value are they selecting, another record from another entity?

    If so, what is the relationship between the two entities please?

    Thanks very much,

    Garry

  • v-yutliu-msft Profile Picture
    on at

    Hi @RMcQueen ,

    Could you tell me:

    1)which entity does the lookup field looks up to ?

    2)ProjectSelectionComboBox's Items?

    3)the relationship between these two combo boxes?

    Only showing me the formula is not enough. Please describe the details.

    4)this lookup field datacard's Update?

    Since you want to update with multiple selections, please set the datacard's Update like this:

    combobox.SelectedItems

    If you use "combobox.Selected", then that's the reason why you met this problem, because "selected" represent the first one selection, not all the selections.

     

     

    Best regards,

  • RMcQueen Profile Picture
    6 on at

    @GarryPope  Yeah there are 3 entities in play here; Projects, Milestones and Benefits.

     

    Project to Milestone 1:N

    Project to Benefit 1:N

    Milestone to Benefit N:N

     

    I have a gallery displaying milestones related to the project selected in a stand along combo box. An edit form displays details of the milestone selected in the gallery. The edit form contains a field which looks up the benefits. The field is filtered to only show benefits related to the project selected in aforementioned combo box and is also set to multiselect. 

     

    I want users to have the ability to add multiple benefits against a milestone any time. The edit form allows for multiple values to be selected in the field, but when submitting the form only one is saved.

    Before submitting the form
    Before.JPG

    After submitting the form
    After.JPG

    Default on the data card is set to ThisItem.'Associated Benefit'

     

    Update on the data card is set to DataCardValue17.Selected (entering SelectedItems presents red lines of doom)

    DefaultSelectedItems on the data card's lookup combo box is set to ThisItem.'Associated Benefit'

     

    I hope this additional information clarifies the situation more.

  • v-yutliu-msft Profile Picture
    on at

    Hi @RMcQueen ,

    Do you mean that:
    1)the field is a lookup field in  milestones entity?

    2)you want to update this field with multiple selections?

    Please notice that:

     all custom lookups can only allow for a reference to a single record for a single target record type.

    This means that one lookup field could only refer to one record, not allows multiple value.

    I suggest you know more about lookup field here:

    https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/types-of-fields

     

    That's the reason why you could only set the datacard's Update to DataCardValue17.Selected instead of "SelectedItems".

    "Selected" represents one selected record. "SelectedItems" represents all selected records.

     

    If you want to reflect the N:N relationship between Milestone to Benefit, please do not use lookup field.

    There's no lookup field between N:N relationship.

    We usually use Relate function to reflect relationship between N:N relationship.

    I suggest you know more about this function:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate

     

     

    Best regards,

  • RMcQueen Profile Picture
    6 on at

    @v-yutliu-msft  - yes the field is a lookup to benefits within in the milestone entitiy and, yes, I'd to update this field with multiple benefits. 

     

    I guess the only way for the users to link multiple benefits to a single milestone will be to add additional fields to the milestone entity which also look up the benefits entity and name them something like 'Associated Benefit 2', 'Associated Benefit 3' etc etc....? 

     

     

  • Ben Thompson Profile Picture
    1,400 on at

    Your best approach would be to follow @v-yutliu-msft advice and create an N:N relationship between Milestone and Benefit and use one of the N:N PCF components found at PCF.gallery such as NN Tags to display the selected options.

     

     

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    Hi @RMcQueen ,

    No, you do not need to create another entity to relate multiple benefits to a single milestone.

    Since you have create a N:N relationship between benefits entity and milestone entity, then you could use Relate function to relate multiple benefits to a single milestone or relate multiple milestones to a single benefit.

    This kind of relationship will not reflect by a lookup field.

    You could directly filter milestone entity based on benefits entity, or filter benefits  entity based on milestone entity, no need to use lookup field.

     

    1)How to relate multiple benefits to a single milestone or relate multiple milestones to a single benefit?

    In powerapps, use formula like this:

    Relate( Entity1RelatedTable, Entity2Record )

    For example, set one combo box's Items to benefits entity, set one gallery's Items to milestone entity.

    Then use this formula to relate multiple benefits to a single milestone:

    Relate(benefitscombobox.SelectedItems,milestonegallery.Selected)

     Then you will relate all the selected items of benefits in that combo box to the selected item of  milestone in the gallery.

    2)How to filter benefits entity based on an item in milestone entity?

    For example: insert a gallery to display benefits entity, set one gallery's Items to milestone entity.

    set gallery1's Items:

    milestone

    set gallery2's Items:

    milestone.Selected.benefits

     Then gallery2 will display related items in benefits entity based on selected item in milestone entity.

     

    The doc that I provided has described this detailed, please refer:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate

     

     

    Best regards,

  • CU01081947-0 Profile Picture
    716 on at

    Hello @RMcQueen,

    I hope all is well. Seems like you got some great advice already, so I hope this has solved your problem.

    Reply if you're still having trouble.

    Thanks very much,

    Garry 

  • FacundoGorla Profile Picture
    293 on at

    I have the N:N relationship but when I try to edit the main Form of any of the two tables I can't add the field in the form, how am I suppose to select wich rows are related? I'm not using a canvas app I'm using a model driven one

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard