cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Station1901
Level: Powered On

Toggle switch that updates sharepoint

I have a toggle switch in a gallery which is simply ON or OFF.  If it is ON I would like it to update a sharepoint list Yes/No field (named NoRota) with YES and if it is OFF I would like the Yes/No field to change to NO.  The gallery sees the Sharepoint list (named CARS) as it is reading in information from there.

 

This sounds like such a simple thing to do but I am still learning to create powerapps and I may also be overthinking it.  Any help or advice would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

Glad you got it to work!

 

So, it sounds like the control needs to have it's Default property set to ThisItem.NoRota

 

Hopefully that works.

 

-Jamie

6 REPLIES 6
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

I think I understand what you want..

 

The gallery displays a list and each item has a checkbox (toggle).  When the user clicks the toggle, you want the record/item to be updated in SharePoint?

 

For the Toggle.OnCheck property I would put:

Patch(SHAREPOINTLISTNAME, ThisItem,{NoRota:true})

For the Toggle.OnUncheck property I would put:

Patch(SHAREPOINTLISTNAME,ThisItem,{NoRota:false})

 

This may introduce a little performance hit depending on the number of records, because it makes a call to SharePoint each time a checkbox is un/checked.

 

I would also highly recommend @Shanescows's videos (available on the Community Video Gallery and his YouTube Channel)./

 

Specifically, he did a 3-part series on using PowerApps to replicate the "repeating tables" functionality of InfoPath (RIP).  I'm pretty sure he covers using galleries and patch to update records in one of those 3 videos.  And probably some others too.

 

Good luck and Happy Apping!

 

-Jamie

Station1901
Level: Powered On

Re: Toggle switch that updates sharepoint

JAMIEWR, Thanks for replying, that does work and does update my sharepoint list, thankyou. The problem I have now is that if I switch the toggle switch to the 'On' position it doesn't stay there. By default the switch is 'OFF', when I switch it to 'On' it updates my sharepoint list with the correct result but the switch then moves back to the 'Off' position. How do I get the toggle switch to stay in the position I set it at?
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

Glad you got it to work!

 

So, it sounds like the control needs to have it's Default property set to ThisItem.NoRota

 

Hopefully that works.

 

-Jamie

Station1901
Level: Powered On

Re: Toggle switch that updates sharepoint

It works perfectly now - Thank you. Another bit of knowledge gained
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

So glad to hear it! -Jamie
Super User
Super User

Re: Toggle switch that updates sharepoint

What is the default value for the toggle?

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 41 members 4,445 guests
Please welcome our newest community members: