Background
We have a canvas app where we are generating new items based on which template the user selected.
The generated items based on the template is stored in a collection and shown to the user.
The bug
The problem is that we get an error saying title is required when patching the collection to dataverse table.
BUT we have already included the title in the patch. The data gets saved, but the error still occurs indicating title is requried.
I have the same patching scenario in a SharePoint Custom Forms App and it works against SP but not against dataverse).
(Power Apps version 3.23011.19)
Dataverse table
To be able to reprocuce the bug I created a simple dataverse table (called "TestPatchBugTable" below) with only one column "Title" of type text and set to required. (I changed name of the primary column "name" to "Title" in the dataverse table)
Code
The following line below gives error indicating that the title column is required.
Patch(TestPatchBugTable; collDataToPatch);;
.. and as you can see there is only one column set in the patch, the title column, which causes the patch collection to fail.
// 1. Get data from a table with templates
Collect(collTemplate;
Table(
{
Title: "From Template 1"
};
{
Title: "From Template 2"
};
{
Title: "From Template 3"
}
)
);;
// 2. For all items in template add an item in collection
Clear(collDataToPatch);;
ForAll(collTemplate;
Collect(collDataToPatch; Defaults(TestPatchBugTable);
{
Title: ThisRecord.Title & " - Test add to collection"
}
)
)
;;
// patch collection from template – gives error
Patch(TestPatchBugTable; collDataToPatch);;