Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Suggested answer

How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch

(1) ShareShare
ReportReport
Posted on by 364
Hello. 
I Have to update some powerapps code to include a section about sensitive data. The power apps reads from a sharepoint list. 
 
I have created a new column within the a sharepoint list, it is a choice column called SensitiveData, it display choice is Checkboxes (Allow multiple selections)
The values of the choice column are : 
PHI
PII
SOX
None of the above
 
On my Form i have added a data card, with a gallery called Gallery1. Inside that Gallery, i have a checkbox called Checkbox4.  This shows all the values of the choice column and allows users to select one or more than once choice. 
 
I have the following code : , but the SensitiveData bit does not update. (as per my comment). The rest works fine. 
 
What am i doing wrong... 
 
Patch(
    'SharePointList',
    LookUp(
        'SharePointList',
        ID = gal_Workspaces.Selected.ID
    ),
    {Update: {Value: "Signed"}},
    {Value: {Value: "Yes"}},
    {Date: Now()},
    {SenstiveData: Gallery1.Selected.Checkbox4} //This is the bit that doesnt work. 
);
Set(
    varPopUp,
    false
);
Navigate(
    Confirmation,
    ScreenTransition.Cover
)
 
What am i doing wrong?.  Can someone help me update the sharepoint list to what ever options the users selects from the checkboxes. 4
 
Thanks 
  • Suggested answer
    WarrenBelz Profile Picture
    146,953 Most Valuable Professional on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    Firstly, I believe your original post has been solved, so please mark that accordingly.  Your next requirement for this rather unusual setup again needs a different approach - this should work in the DisplayMode of the checkbox
    If(
       CountRows(colSelected) > 0 && 
       (
          (
             CountRows(
                Filter(
                   colSelected,
                   Value = "Non-Sensitive"
                )
             ) > 0 && 
             ThisItem.Value <> "Non-Sensitive"
          ) || 
          (
             CountRows(
                Filter(
                   colSelected,
                   Value <> "Non-Sensitive"
                )
             ) > 0 && 
             ThisItem.Value = "Non-Sensitive"
          )
       ),
       DisplayMode.Disabled,
       DisplayMode.Edit
    )
     
    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.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Vstar19 Profile Picture
    364 on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    Brillant Thank You. 
     
     
    One Final thing. 
     
    So i have 4 check box values
     
    1. PHI, 
    2. PHII, 
    3. SOX
    4. Non-Sensitive
     
    If a user selects Non-Sensitive... How can i disable the other options?, i.e. if they select Non-Sensitive, they should not be able to select PHI, PII or SOX. 
    Additionally, if they select PHI or PHII or SOX, they should not be able to select Non-Sensitive. 
     
    Thanks 
  • WarrenBelz Profile Picture
    146,953 Most Valuable Professional on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    This depends if you are on an existing or new record. On existing records, the values are designed to remain as you have just updated the record and the Default of the checkbox
    ThisItem.Value in 
    LookUp(
       'SharePointList',
       ID = gal_Workspaces.Selected.ID
    ).SensitiveData.Value
    will then read that record and the checkboxes will show the value you just patched. Resetting the check boxes will not alter this (as they will simply read the record values again).
    For new records, you have an issue as  controls in a gallery cannot be reset from outside the gallery, so 
    Reset(CheckBox4)
    is not going to work (you may also get an error on this). You need to set the Reset property of the check box to a Variable (I have used varReset ) and then toggle the Variable (put this at the end of your patch code)
    UpdateContext({varReset: true});
    UpdateContext({varReset: false});
     
    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.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • MS.Ragavendar Profile Picture
    1,844 on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch

    After the Patch, reset the control that holds the selections

    Reset(urcontrolname);

    If using checkboxes bound to a collection

    Clear(collectionName);

     

     

    🏷️ 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.
  • Vstar19 Profile Picture
    364 on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    Thanks Warren. 
    This appears to be now working. 
     
    How do i clear the selection?. the checkbox always go back to what ever was previously selected. 
     
    Once i hit save, i would like to clear the values?
     
     
  • Suggested answer
    WarrenBelz Profile Picture
    146,953 Most Valuable Professional on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    This one comes into the category of "should work but does not" - the reason I am guessing being that galleries were never designed to be inside Data Cards inside Forms and although you can manage to insert one with a bit of effort, anything outside the data card simply cannot properly reference the contents of the gallery - the result in my testing was that the filter when run from outside the form returned no records (therefore wrote nothing back).
    I have a workaround that seems to work - OnSelect of the CheckBox
    ClearCollect(
       colSelected,
       Filter(
          Gallery1.AllItems,
          Checkbox4.Value
       )
    )
    This however is going to cause issues with existing records as the collection will not contain those values initially - so your Patch
    With(
       {
          _Record:
          LookUp(
             'SharePointList',
             ID = gal_Workspaces.Selected.ID
          )
       },
       Patch(
          'SharePointList',
          _Record,
          {
             Update: {Value: "Signed"},
             Value: {Value: "Yes"},
             Date: Now(),
             SensitiveData: 
             If(
                IsEmpty(colSelected),
                _Record.SensitiveData,
                ForAll(
                   colSelected As _Data,
                   {Value: _Data.Value}
                )
             )
          }
       )
    );
    Clear(colSelected)
    
    It would also be a good idea to clear the colleciton whenever you select a new record.
     
    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.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Vstar19 Profile Picture
    364 on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    both the above formulaes save without error - but they are not updating the Sharepoint list with the checkboxes i selected.  The Sensitive Data column in sharepoint remains blank after i press the button (i have refreshed the sharepoint page)
     
  • WarrenBelz Profile Picture
    146,953 Most Valuable Professional on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
    The Patch would be - assuming here that the Items of the Gallery is Choices('SharePointList'.SensitiveData)
    {
       SenstiveData:
       ForAll(
          Filter(
             Gallery1.AllItems, 
             Checkbox4.Value
          ) As _Data,
          {Value: _Data.Value}
       )
    }
    Is this for new records only -  the values in the Gallery checkboxes for existing records requires a bit more thought here. Assuming you are using classic checkboxes, the Default of the CheckBox should be
    ThisItem.Value in 
    LookUp(
       'SharePointList',
       ID = gal_Workspaces.Selected.ID
    ).SensitiveData.Value
     
    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.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Suggested answer
    MS.Ragavendar Profile Picture
    1,844 on at
    How to updates a sharepoint choice (multiple selections) list column from Power Apps using Patch
     
    Gallery1.Selected.Checkbox4 only returns one selected item (the one associated with the checkbox control), but your SensitiveData SharePoint column expects an array of records in this format: 
     
    [{Value: "PHI"}, {Value: "PII"}]
     
    Patch Formula
     
    Patch(
        'SharePointList',
        LookUp(
            'SharePointList',
            ID = gal_Workspaces.Selected.ID
        ),
        {
            Update: {Value: "Signed"},
            Value: {Value: "Yes"},
            Date: Now(),
            SensitiveData: 
                ForAll(
                    Filter(Gallery1.AllItems, Checkbox4.Value),
                    {Value: ThisRecord.Value}
                )
        }
    );
     
    🏷️ 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.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 55 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 42 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 31 Super User 2025 Season 1

Overall leaderboard