cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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})

 

Highlighted

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

Highlighted
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

Highlighted

Thank You

 

 

Working😁

Highlighted

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.

Highlighted

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.
Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,993)