I was over here on this post, which said to turn on Formula-level Error Management in the app settings because I needed to patch a Blank() to a date field.
However, now I'm getting errors I've never had before in my Patch code, about other required fields.
My Patch code is
Patch(
'CDS Entity',
Defaults('CDS Entity'),
{
UserID : "10412"
DateSurveyTaken : Today(),
Name : varMindID&"-"&Today()
}
)
UserID is a Text field. DateSurveyTaken is a Date field. Name is a Text field. All are required.
My second Patch code elsewhere in the app is
Patch(
'CDS Entity2',
Defaults('CDS Entity2'),
{
SubmittedDate : Blank()
}
)
With the feature turned OFF, the first Patch works perfectly, but the second Patch fails (doesn't remove the date from SubmittedDate, but no error is flagged in the Canvas app).
With the feature turned ON, the second Patch works as desired by removing the date in SubmittedDate, but the first Patch now flags errors for UserID, DateSurveyTaken and Name (one at a time), saying that "this field is required". But I already have them in the Patch and have given them valid values! The only way to get past the errors is to go to PowerApps and set the fields as Optional/Recommended instead of Required. So first it flagged an error for UserID, so I changed that field to not required. Then it just picked up the next required field DateSurveyTaken to flag an error about, so I changed that and then Name got flagged and so on. Without any required fields, Patch doesn't save any values to the CDS record. It can create the new record but all fields are blank, even though my variables are all populated and I'm passing valid values through in my Patch code.
But why? Everything worked perfectly without the feature. I need the feature for the blank() date but I'd also like to know why the feature is seeing an issue with my required fields.
Edited: At first I thought it was fine with UserID being required but now it's getting flagged too! I can't have ANY required fields. And this is now a BIG problem because without any required fields Patch is just creating an empty record and isn't saving the perfectly legit values that I am passing.