web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using a toggle in a ga...
Power Apps
Unanswered

Using a toggle in a gallery to edit a SharePoint item

(0) ShareShare
ReportReport
Posted on by 2

Hello, 

 

I am wondering if it is possible to add a toggle in a gallery that when changed, will change the content of an item in the SharePoint site connected to the Gallery? 

 

For example, I have an "Active/Inactive" Column in my SharePoint site. When the toggle is turned on, I would like the "Active/Inactive" field of the corresponding item to change from Active to Inactive. 

 

Is this a possibility within Power Apps, and how might I go about executing this function? 

 

Thank you, 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @NewUser2626 

    Let’s assume your SharePoint list has a column called Active/Inactive and is a Choices type column.  It has two options “Active”, “Inactive”

     

    Put this code the Items property of your gallery

     

    your_sharepoint_list

     

    Then place a toggle inside the gallery.  Use this code in the OnChange property:

     

    Patch(your_sharepoint_list, LookUp(your_sharepoint_list, ID=ThisItem.ID), {‘Active/Inactive’.Value=If(ThisItem.Toggle1.Value,“Active”, “Inactive”)})

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • NewUser2626 Profile Picture
    2 on at

    Hello @mdevaney 

     

    Thank you for your response, when I input the code into the OnChange property of the toggle, a red line appears underneath the end part of the code - {‘Active/Inactive’.Value=If(ThisItem.Toggle1.Value,“Active”, “Inactive”)}. How can I edit this to be able to change an item in my sharepoint list when the toggle is turned on. 

     

    Thank you

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @NewUser2626 ,

    Is "Active/Inactive"  choice type?

    I assume that yes.

    Please set like this:
    1)insert a gallery, set its Items: your sharepoint list

    2)insert a toggle inside the gallery

    set the toggle's Default:

    ThisItem.Active/Inactive.Value="Active"

     set the toggle's OnChange:

    If(togglename.Value,
    Patch(sharepoint list name,ThisItem,{Active/Inactive.Value:"Active"}),
    Patch(sharepoint list name,ThisItem,{Active/Inactive.Value:"Inactive"})
    )

     

     

    Best regards,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 602

#2
WarrenBelz Profile Picture

WarrenBelz 473 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 310

Last 30 days Overall leaderboard