cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Patch Checkbox

Hi

 

I have read some post in here regarding patch a checkbox to SharePoint, but I can't make it work.

 

I have a SharePoint list called SAP_import, with a collumn named "Checkbox"  (YES/NO field)

 

I have a galley with a checkbox for each item/row.

 

OnUncheck :   Patch(SAP_Import;ThisItem.CheckBox,{Checkbox:"Yes"})

 

OnUncheck: Patch(SAP_Import;ThisItem.CheckBox; {Checkbox: No})

 

Default:  If(ThisItem.CheckBox="Yes";true;false)

 

It says boolean not valid, should be a value

 

Can anyone see what is wrong ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Thansson ,

Do you want to use a checkbox to update a yes/no field of sharepoint list?
If so, you should compare this field with true or false, not "yes" or "no".

"Yes" or "No" is text string, not boolen value.

Try to set this:
the checkbox's OnCheck:

Patch(SAP_Import;ThisItem,{Checkbox:true})

//the second parameter should be the item that you want to update

the checkbox's OnUncheck:

Patch(SAP_Import;ThisItem; {Checkbox: false})

checkbox's Default:

ThisItem.Checkbox

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Advocate I
Advocate I

Which line are you getting the error on?

 

A notes - shouldn't the first item be 'OnCheck'?

Also, I think you need to replace the Yes/No here with true/false.  Plus remove any quotes.

OnUncheck : Patch(SAP_Import;ThisItem.CheckBox,{Checkbox:"Yes"})

 

OnUncheck: Patch(SAP_Import;ThisItem.CheckBox; {Checkbox: No})

 

Hi Tks.

 

Yes I spelled wrong.

 

I dont get any error, it dosn't work at all, but if I move the cursor to the line, it tells wrong type data, but I cant change the YES/No in SharePoint, as far as I know

Community Support
Community Support

Hi @Thansson ,

Do you want to use a checkbox to update a yes/no field of sharepoint list?
If so, you should compare this field with true or false, not "yes" or "no".

"Yes" or "No" is text string, not boolen value.

Try to set this:
the checkbox's OnCheck:

Patch(SAP_Import;ThisItem,{Checkbox:true})

//the second parameter should be the item that you want to update

the checkbox's OnUncheck:

Patch(SAP_Import;ThisItem; {Checkbox: false})

checkbox's Default:

ThisItem.Checkbox

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank You

 

 

Working😁

Hi Again

 

It is working, but the default need to be changed around.

 

The default when open app it is "Checked".

 

How will you make default?   I'am geting error no matter what I try.

Hi @Thansson ,

Do you mean that:
you want that checkbox display as checked by default?

If so, you just need to set the checkbox 's Default to : true.

10202.PNG

 

If you want this checkbox display that field value by default, then you should set the check box's Default to :

ThisItem.yesornofieldname

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi v-yutliu-msft

 

I want checkbox to be unchecked as default.

 

If I set Checkboks to default = False  

 

the checkbox will no longer patch, nothing happends in the app?

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,549)