cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OlaH
Resolver I
Resolver I

Patch toggle value to Dataverse for Teams

Hi dear friends. Could you please help me find my mistake so that I can learn how to use a toggle in the galleri and patch it to Dataverse for Teams.

 

I've tested this with @RezaDorranis excellent sample solution to import in Dataverse for Teams: https://youtu.be/vRn7br2OaxE 

 

  1. I just added a Yes/No column called Klart (ready in swedish) in the table  (see image)
  2. ... and then a toggle in gallery - ThisItem.Klart
  3. Update the btnClick 
  4. ... and got the value as I expected in the collection. (see image)
  5. But then I got an error in the patch function. Table instead of a record value. (see image)

 

 

My project is to move existing apps for teacher where they mark different goal that the students have achived. These works fine in SP but I have some things to learn in Dataverse for Teams.

6 REPLIES 6
CNT
Super User
Super User

@OlaH

 The problem is, in your collection, the value for Klart column is true/false (as returned by the toggle). But dataverse needs a value, 'Klart (Work Progess Trackings)'.Yes or 'Klart (Work Progess Trackings)'.No

 

So, when you collect the values into your collection, you have to do this (instead of, just Toggle1.Checked)

If(Toggle1.Checked, 'Klart (Work Progess Trackings)'.Yes or 'Klart (Work Progess Trackings)'.No)

 

Note: You may have to replace Yes/No with Ja/Nej (because of Swedish). Please check.

CNT
Super User
Super User

@OlaH Just checking if you tried my solution and if you were able to get it working.

Thank you @CNT 

Excuse me but I don't really understand. So a toggle or checkbox in Dataverse doesn't work as a boolean in a SharePoint list. 

 

So the value, "True", as in my collection (see picture), is not enough?

Do I really have to write an If-statement to get Yes/No instead of true/false?

I've tried you suggestion but can't get it to work.

 

Ola

 

@OlaH What is the Error you are getting in the Patch?

Here's the message, @CNT . And as you can see in the picture above, colTaskUpdate.png, "Klart ..." is a value (True/False).

Patch message.png

@OlaH The second parameter in Patch has to be either a BaseRecord  - The record to modify or create or BaseRecordTable - A table of records to modify or create.

Then you need a third Parameter with either a Record with field(s) that have to be changed or a Table with Records that have to be changed.

Please refer to the syntax here, https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-patch

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,275)