cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thansson
Helper I
Helper I

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
v-yutliu-msft
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
HarjitSamra
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

v-yutliu-msft
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (57,163)