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

Creating a record with empty fields...

Hi,

 

I'm having some issues with a Canvas App I've created linked to Dataverse. 

Table: Table1

Columns: Place (Lookup at table Places), Vehicle (Lookup at table Vehicles), Date, Complete (Yes/No), Remark (Text)

 

The app consists of 2 comboboxes (place, vehicle), a date field, a checkbox and a textfield and a big button to submit.

The comboboxes only allow 1 selection.

 

In the OnSelect of the submitbutton, I have the following:

 

 

Patch(Table1, Defaults(Table1), {

Place: cmbPlace.Selected,

Vehicle: cmbVehicle.Selected,

Date: dtpDate.SelectedDate,

Complete: chkComplete.Value,

Remark: txtRemark.Text})

 

 

 

Everything works like a charm when everything is filled in. But if Place and/or Vehicle is empty it won't create a new record in Table1. 

I've tried several things, such as: If((IsBlankOrError(cmbVehicle.Selected) || IsEmpty(cmbVehicle.Selected)), Set(varVehicle, {}), Set(varVehicle, cmbVehicle.Selected) or If((IsBlankOrError(cmbVehicle.Selected) || IsEmpty(cmbVehicle.Selected)), Set(varVehicle, Blank()), Set(varVehicle, cmbVehicle.Selected).

 

Can someone help me, please? 😋

1 ACCEPTED SOLUTION

Accepted Solutions
KCoeck
Regular Visitor

This issue was solved by switching on an experimental feature called 'Formula level error management'.

By switching that on, Power Apps suddenly allows Blank() to be patched to the lookup columns in Dataverse. 

View solution in original post

4 REPLIES 4
zmansuri
Super User
Super User

You need both id and value to patch a lookup field.

Patch('SP List',Defaults('SP List'),{Id: -1, Value:Blank()})

 

This is how you patch a blank value in lookup field. tweak it according in your code.

Hi!

 

Thanks for your quick reply! 

I still get the error: "value must be a data entity record" 😐

Oh then it must be different for dataverse. It does work in sharePoint. Sorry i can't be any more help. Since i have no exp with Dataverse

KCoeck
Regular Visitor

This issue was solved by switching on an experimental feature called 'Formula level error management'.

By switching that on, Power Apps suddenly allows Blank() to be patched to the lookup columns in Dataverse. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,594)