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 / Checkbox updates SP List
Power Apps
Answered

Checkbox updates SP List

(0) ShareShare
ReportReport
Posted on by 108

Hi everyone,

 

I am trying to create an "availabilty" function in our app. User opens startscreen and gets 3 checkboxes:checkbox.png

These checkboxes should be connected to a SP List called 'Members' which has 2 columns; E-mail adress and Availability (single line of text).

 

I would like with the OnCheck function to update the 2nd column by whoever is logged in to the app. And if one box is checked the others are automatically unchecked.

 

I found how to update the SP List from the checkbutton with a patch formula, but not how to connect is to Current User.

 

Hope you can help!

 

Kind regards,

 

Roger Middleton

Categories:
I have the same question (0)
  • Verified answer
    rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    Hi there the current user is User(), you can get User().DisplayName or User().Email

    you can update a variable on the OnCheck like UpdateContext({_SelectCheckBox:1}) etc and set the Default of the checkboxes to If(_SelectCheckBox=1,true,false) based on the checkbox you are on. 

     

    so

    checkbox1 = UpdateContext({_SelectCheckBox:1})

    checkbox2 = UpdateContext({_SelectCheckBox:2})

    checkbox3 = UpdateContext({_SelectCheckBox:3})

     

    checkbox1 deafualt =If(_SelectCheckBox=1,true,false)

    checkbox2 deafualt =If(_SelectCheckBox=2,true,false)

    checkbox3 deafualt =If(_SelectCheckBox=3,true,false)

     

     

     

     

  • Rogermiddleton Profile Picture
    108 on at

    Hi @rubin_boer ,

     

    Thank you for your help. I am not getting the patch function to work (in code below). Where 'Kimmembers'  is the SPlist, 'Naam' is the first column with the email adress in, and ' Beschikbaarheid'  is the column that needs to be updated.

    You got any idea what I am doing wrong?

    Patch(
     KimMembers;
     Defaults(KimMembers);
     {
     Naam: User().Email;
     Beschikbaarheid: Checkbox2.Groen
     }
    )
  • Verified answer
    Dutchmann Profile Picture
    30 on at

    Hi @Rogermiddleton , as you are talking about data that needs to be updated, I believe the 

    Defaults(KimMembers)

    is creating your problem. Defaults is used to create a new record in your dataset. When you want to update a record, you need to lookup the record first. This would mean that the following formula would bring you closer to what you want.

     

    Patch(
     KimMembers;
     LookUp(KimMembers;Email=User().Email);
     {
     Beschikbaarheid: Checkbox2.Groen
     }
    )

     

    What this does is looking up the specific record in your dataset which needs to be updated. Whenever it find that record, it returns the whole record. Then, the next part of the Patch is used to only update whatever you need to update. So, in order to filter on User().Email, that user should already exist in your dataset. Therefore, it is not necessary to update the 'Naam' column.

     

    Let me know if this answers your question.

  • Rogermiddleton Profile Picture
    108 on at

    Hi @Dutchmann ,

     

    This worked great, thanks! (tiny bit of modification). The search for email was too big and the lookup didnt work. The Title column for some reason did work so i put the emailadresses in the title column and made a Lookup on a label with current user in it.

    Patch( KimMembers; LookUp(KimMembers;Titel=LabelEm.Text);{Avail: "Groen"})

     

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard