Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Patching Combo box fields (multi-values)

(1) ShareShare
ReportReport
Posted on by 16
Hi,

I have the following single line of text fields in a Sharepoint List:
  • Fiscal year
  • Period
  • Business Unit
  • Cost Center
  • G/L Account
Then in my Power Apps form, these fields are all in combo box control. The choices for each are coming from different secondary sharepoint lists. Then I allowed multiple-select for Cost Center and G/L Account.

Whenever I submit a new item, the values selected in these 5 fields are not stored/reflected in the Sharepoint list.

Here's the configuration of my form.

In my Submit button's OnSelect is:
 
NewForm(NewForm);
SubmitForm(NewForm);


Then in my NewForm's OnSuccess property:

Set(
    varRecord,
    Self.LastSubmit
);
 
If(
    IsError(
        Patch(
            'DataSource',
            varRecord,
            {
                'Fiscal Year': combo_FY.Selected.'Fiscal Year',
                'Period': combo_Period.Selected.Title,
                'Business Unit': combo_BU.Selected.Title,
                'Cost Center': Left(Concat(combo_CC.SelectedItems, Title & ", "), Len(Concat(combo_CC.SelectedItems, Title & ", ")) - 2),
                'G/L Account': Left(Concat(cb_GL.SelectedItems, 'GL code' & ", "), Len(Concat(cb_GL.SelectedItems, 'GL code' & ", ")) - 2),
                Flag: 1
            }
        )
    );
    Notify("Patch failed", NotificationType.Error),
    Notify("Patch succeeded", NotificationType.Success)
);
 
Navigate(HomeScreen, ScreenTransition.None);

I have tested this, it says 'Patch succeeded' but still, values are not reflected in Sharepoint. I tested selecting multiple values of Cost Center and G/L Account. I even tried changing it to internal names like:



What am I missing?

Again, in my main list, these fields are single line of text but in the form, I made them as combo box controls with choices coming from different sharepoint list.
  • Verified answer
    WarrenBelz Profile Picture
    148,894 Most Valuable Professional on at
    Patching Combo box fields (multi-values)
    We all assumed that you had a reason for patching OnSuccess after submitting the Form - this is normally done when additional values not on the Form are added.
    If both of those are multi-select Combo Boxes and the field is a Single Line of Text, then the Update would be
    Concat(
       combo_FY.SelectedItems,
       'Fiscal Year',
       ", "
    )
    and
    Concat(
       combo_BU.SelectedItems,
       Title,
       ", "
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Suggested answer
    LaraDanicaLim Profile Picture
    16 on at
    Patching Combo box fields (multi-values)
    Hi, @WarrenBelz @MS.Ragavendar @stampcoin.

    Thanks for all your responses. I tried everything. However, I tried searching more and figured that patching is not needed. Since the combo boxes are already inside a data card, the data card's Update property must be configured like: 
     
    combo_FY.Selected.'Fiscal Year'
    combo_BU.Selected.Title

    and etc.

    Then  
    SubmitForm(New_Form); is already enough without patching.

    Anyway, thank you so much! This is my first time with Power Apps so I'm still having challenges with the basics.
  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on at
    Patching Combo box fields (multi-values)
    Adding to what @stampcoin has posted, if you are actually needing to patch that data OnSuccess of the Form, there are a number of fundamental issues with what you are doing: -
    • You have NewForm(NewForm) before SubmitForm(NewForm), which means the form will be cleared before you submit it.
    • NewForm is not a good name for a Form as it is a Reserved Word in Power Apps and I suggest you change it.
    • Once the Form is submitted, the values are cleared, meaning you cannot then reference the control values OnSuccess
    • You do not need all the string manipulation on the Concat - @stampcoin has also addressed this - if you use what is posted.
    With all that in mind, you can set a Table Variable before you submit the Form like this
    UpdateContext(
       {
          varRecord:
          {
             'Fiscal Year': combo_FY.Selected.'Fiscal Year',
             'Period': combo_Period.Selected.Title,
             'Business Unit': combo_BU.Selected.Title,
             'Cost Center': Concat(combo_CC.SelectedItems, Title, ", "),
             'G/L Account': Concat(cb_GL.SelectedItems, 'GL code', ", "),
             Flag: 1
          }
       }
    );
    SubmitForm(NewForm);
    NewForm(NewForm)
    and the OnSuccess
    If(
       IsError(
          Patch(
             'DataSource',
             Self.LastSubmit,
             {
                'Fiscal Year': varRecord.'Fiscal Year',
                'Period': varRecord.Period',
                'Business Unit': varRecord.'Business Unit',
                'Cost Center': varRecord.'Cost Center',
                'G/L Account': varRecord.'G/L Account'
                Flag: 1
             }
          )
       );
       Notify("Patch failed", NotificationType.Error),
       Notify("Patch succeeded", NotificationType.Success)
    );
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Suggested answer
    MS.Ragavendar Profile Picture
    2,775 Super User 2025 Season 2 on at
    Patching Combo box fields (multi-values)
     
    For Single Line of Text just give comboboxcontrolname.Selected
     
    More Info
     
     
    Instead of this,
    Set(
        varRecord,
        Self.LastSubmit
    );
     
    Try with Defaults(DataSource) for newly creation of record for existing record use Lookup(datasource, ID=ItemId) accordingly.
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • Suggested answer
    stampcoin Profile Picture
    3,436 Super User 2025 Season 2 on at
    Patching Combo box fields (multi-values)
     
    Instead of relying on SubmitForm and then patching, directly use Patch in your button's OnSelect to ensure correct data submission in one step.
    Replace your button's OnSelect property with the following (adjusting field/internal names accordingly)
     
    // Prepare concatenated strings for multi-select combo boxes
    Set(
        varCostCenters,
        Concat(combo_CC.SelectedItems, Title, ", ")
    );
    
    Set(
        varGLAccounts,
        Concat(cb_GL.SelectedItems, 'GL code', ", ")
    );
    
    // Patch a new record directly
    Set(
        varRecord,
        Patch(
            'DataSource',
            Defaults('DataSource'),
            {
                'Fiscal Year': combo_FY.Selected.'Fiscal Year',
                'Period': combo_Period.Selected.Title,
                'Business Unit': combo_BU.Selected.Title,
                'Cost Center': varCostCenters,
                'G/L Account': varGLAccounts,
                Flag: 1
            }
        )
    );
    
    // Check if patch succeeded
    If(
        !IsBlank(varRecord),
        Notify("Patch succeeded", NotificationType.Success);
        Navigate(HomeScreen, ScreenTransition.None),
        Notify("Patch failed", NotificationType.Error)
    );
    
     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2