YouTube
Create
To create Dataverse records from Canvas Apps, the Patch function will need to be used.
When using the Patch function, you will need to reference the following:
- Table
- Record – when creating you will use Defaults({table name}) which will use the table structure
- Fields included as part of creation
Here is an example:
Patch(Accounts, Defaults(Accounts),
{
'Account Name': text_AccountName_DV_1.Text,
'Account Status': combo_Status_DV_1.Selected.Value,
'Last Contacted': date_LastContacted_DV_1.SelectedDate,
'Annual Revenue': Value(text_AnnualRev_DV.Text),
'Primary Contact': combo_PrimaryContact_Create.Selected
}
);
Update
To update Dataverse records from Canvas Apps, the Patch function will also be used just like create.
When using the Patch function, you will need to reference the following:
- Table
- Record – the full record will need to be referenced either through a gallery or looking up to the record itself
- Fields that require updating
Here is an example:
Patch(Accounts, gallery_Accounts_DV_1.Selected,
{
'Account Name': text_AccountName_DV_2.Text,
'Account Status': combo_Status_DV_2.Selected.Value,
'Last Contacted': date_LastContacted_DV_2.SelectedDate,
'Annual Revenue': Value(text_AnnualRev_DV_1.Text),
'Primary Contact': combo_PrimaryContact_Update.Selected
}
);
Delete
To delete records in Dataverse, the remove function will be used.
When using the Remove function, you will need to reference the following:
- Table
- Record – the full record will need to be referenced either through a gallery or looking up to the record itself
Here is an example:
Remove(Accounts, gallery_Accounts_DV_1.Selected);
