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 / Toggle button in galle...
Power Apps
Unanswered

Toggle button in gallery to update SP list

(0) ShareShare
ReportReport
Posted on by 87

Hi,

 

I'm struggling to get a toggle (yes/no) to update a sharepoint list when changed.

I have put the toggle in a gallery so that I can update each item but I can't get it to work.

Sharepoint list: Liste_1

Column to update (Yes/No): Til_fakturering

 

Toggle button Default:

If(
ThisItem.Til_fakturering.Value = true,
true,
false
)

Toggle button OnSelect:

Patch(
Liste_1,
LookUp(
Liste_1,
ID = ThisItem.ID
),
{
Til_fakturering: If(
Toggle3.Value = true,
true,
false
)
}
)

 

Does anyone know why this is not working?

 

Categories:
I have the same question (0)
  • Verified answer
    SebS Profile Picture
    4,582 Moderator on at

    @Gundi76 

     

    If You looking to store the value true/false in Yes/No column You over complicate it

     

    It should be simple as:

     

    in Toggle button OnChange rather OnSelect:

     

    Toggle button OnChange:
    
    Patch(
    Liste_1,
    ThisItem,
    {
    Til_fakturering: Toggle3.Value
    }
    )

     

     

    Toggle on it own as a result of switching it contain true or false so no need for if condition

     

    In the Default property place ThisItem.Til_fakturering that will set up all toggles to whatever is in the List on DataSource Load

     

     

  • Gundi76 Profile Picture
    87 on at

    Thanks @SebS ,

     

    I still get "The function Patch has some invalid arguments - location: Toggle 3 . OnChange" & "The type of this argument 'Til_x0020_Fakturering' does not match the expected type 'Record'. Found type 'Boolean' - Location: Toggle 3 . OnChange"

     

    Is this because I have Yes/No in the column choice field?

  • SebS Profile Picture
    4,582 Moderator on at

    @Gundi76 

     

    Do you use Choice Column rather Yes/No in SharePoint List by any chance ?

  • Gundi76 Profile Picture
    87 on at

    @SebS It's a choice column (Yes/No)

  • SebS Profile Picture
    4,582 Moderator on at

    @Gundi76 

     

    Confused 🙂

     

    In SharePoint there is a Yes/No column this one can store only true/false and 

    there is a Choice column what you can pre-set choices choices like Yes / No , Red , Green 

     

    Witch one You using is it first Yes/No or the second as there is a difference how You patching it but I recommend to Use Yes/No column for that type of actions

  • Gundi76 Profile Picture
    87 on at

    @SebS I changed the column to Yes/No and now it works :). Thanks for your help 🙂

  • SebS Profile Picture
    4,582 Moderator on at

    @Gundi76 

     

    No Problem 

     

    also just for reference if You patching Choice column You need Patch to it Value

     

    This would look like this but also You will need to make sure the Toggle3 will be Yes/No rather true / false and to do that You will need If condition what makes it complicated and not worth the hassle

    Patch(
    Liste_1,
    ThisItem,
    {
    Til_fakturering: {Value:IF(Toggle3.Value,"Yes","No")}
    }
    )

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard