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

Update property for multi-select combo box

I have two multi-select combo boxes with multiple values enabled for the two corresponding lookup columns in SharePoint. The options are getting populated , but I'm not able to get the selected options captured in the SharePoint list.

ComboBox1:

Items = RenameColumns(
    Distinct(
        Filter(
            'Product Mapping',
            Country.Id = DataCardValue23.Selected.Id
        ),
        Title
    ),
    "Result",
    "CountryName"
)

Update = ForAll(
        DataCardValue32.SelectedItems,
        {
           Value: CountryName
        }
)

ComboBox2:

Items = ShowColumns(
    Filter('Country Mapping',Title in DataCardValue32.SelectedItems.Value
    ),
    "ProductCode",
    "ID"
)

Update = ForAll(
        DataCardValue28.SelectedItems,
        {
           Value: ProductCode
        }
)

 Any advice would be greatly appreciated. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

Hi @nouptime 

 

Here is a Syntax and example for the Patch function with a lookup to another SP list.

Syntax

Patch(
    DataSource,
    If(
        EditForm1.Mode = FormMode.New,
        Defaults(DataSource),
        LookUp(
            DataSource,
            ID = SelectedId
        )
    ),
    {
        Title: DataCardValue9.Text,
        LookupColumnName: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: DataCardValue14.Selected.Id,
            Value: DataCardValue14.Selected.Value
        }
    }
);

Example

IssueTracker - SP List Name

Event - Lookup column name which references another SP list

SelectedId - Variable from Gallery Screen. SP item that updating /Editing

Patch(
    IssueTracker,
    If(
        EditForm1.Mode = FormMode.New,
        Defaults(IssueTracker),
        LookUp(
            IssueTracker,
            ID = SelectedId
        )
    ),
    {
        Title: DataCardValue9.Text,
        Event: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: DataCardValue14.Selected.Id,
            Value: DataCardValue14.Selected.Value
        }
    }
);

 

View solution in original post

5 REPLIES 5
CNT
Super User
Super User

@nouptime The update property should be,

ComboBox1

DataCardValue32.SelectedItems

 

ComboBox2

DataCardValue28.SelectedItems

 

nouptime
Frequent Visitor

@CNT Thanks for the reply. These were the default update properties for both combo boxes initially, but for some reason the selected options weren't showing up in the SharePoint list either.

StalinPonnusamy
Community Champion
Community Champion

Hi   @nouptime 

 

As  @CNT mentioned Update property is sufficient for the form to know what needs to be saved. For all loop is not needed on update property. In this example, I'm saving multi-select option

StalinPonnusamy_1-1628342076154.png

 

  • I'm looking for Items property for your combo box. Is the combo box Choice column in SP?
  • If this Choice column then Items property should be

 

 

Choices([@SPList].ColumnName)

 

 

 

Hi @StalinPonnusamy. Many thanks for the confirmation, much appreciated. I have amended the Update property. 

 

Sorry to deviate from the initial question, but how would I build a Patch function for both fields? I have an OnSuccess event in the same form that pushes values to a flow in Power Automate. Fyi both Product and Country are Lookup columns in SP, referencing two separate SP lists.

 

Was thinking of the below but I'm sure something is missing, as indicated by the invalid argument and missing column errors:

 

Patch(ItemsList, LookUp(ItemsList,ID=Id), {'Country': DataCardValue32.SelectedItems} );

 

nouptime_1-1628357394507.png

 

 

StalinPonnusamy
Community Champion
Community Champion

Hi @nouptime 

 

Here is a Syntax and example for the Patch function with a lookup to another SP list.

Syntax

Patch(
    DataSource,
    If(
        EditForm1.Mode = FormMode.New,
        Defaults(DataSource),
        LookUp(
            DataSource,
            ID = SelectedId
        )
    ),
    {
        Title: DataCardValue9.Text,
        LookupColumnName: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: DataCardValue14.Selected.Id,
            Value: DataCardValue14.Selected.Value
        }
    }
);

Example

IssueTracker - SP List Name

Event - Lookup column name which references another SP list

SelectedId - Variable from Gallery Screen. SP item that updating /Editing

Patch(
    IssueTracker,
    If(
        EditForm1.Mode = FormMode.New,
        Defaults(IssueTracker),
        LookUp(
            IssueTracker,
            ID = SelectedId
        )
    ),
    {
        Title: DataCardValue9.Text,
        Event: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: DataCardValue14.Selected.Id,
            Value: DataCardValue14.Selected.Value
        }
    }
);

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,870)