I have a Canvas app connected to an on-premise SQL Server gateway. The connection is successful, and records can be viewed using the data table preview.
I used a button underneath the data table to navigate to an "Edit" screen that will edit the record selected on the data table (DT). The form preloads with the DT data successfully and everything appears to work correctly. However, when using a button with the SubmitForm(form) function I received the error
Network error when using patch function: the specified record was not found.
With no success, I tried changing the SubmitForm(FormName) function to Patch instead.
Example trying to edit a single field using patch:
Patch(OnPremiseSQLDB,dt_DataTable.Selected,
{Notes: DataCardValue46.Text});
Same error.
I have spent well over 2 hours trying to figure out this issue and have been unsuccessful.
I turned on monitoring and received the following logs:
- Network - patchRow - Error - Not Found
{
"status": 404,
"duration": 74.39,
"dataSource": "OnPremiseSQLDB",
"responseSize": 54,
"controlName": "btn_FormSave",
"propertyName": "OnSelect",
"nodeId": 7,
"formulaData": {
"script": "Patch(OnPremiseSQLDB,dt_DataTable.Selected,\r\n{Notes: DataCardValue46.Text})",
"spanStart": 0,
"spanEnd": 74
},
"data": {
"context": {
"entityName": "btn_FormSave",
"propertyName": "OnSelect",
"id": 13538,
"nodeId": 7,
"diagnosticContext": {
"span": {
"start": 0,
"end": 74
},
"dataOperation": {
"protocol": "cdp",
"operation": "patchRow",
"apiId": "/providers/microsoft.powerapps/apis/shared_sql",
"dataSource": "UT_IVCustom",
"table": "[dbo].[UT_IVCustom]",
"operationName": "CdpConnector.patchRowAsync"
},
"formula": "Patch(OnPremiseSQLDB,dt_DataTable.Selected,\r\n{Notes: DataCardValue46.Text})"
}
},
- Function - Patch - Error -
{
"status": null,
"duration": null,
"dataSource": null,
"responseSize": null,
"controlName": "btn_UT_IVCustomSave",
"propertyName": "OnSelect",
"nodeId": 7,
"formulaData": {
"script": "Patch(OnPremiseSQLDB,dt_DataTable.Selected,\r\n{Notes: DataCardValue46.Text})",
"spanStart": 0,
"spanEnd": 74
},
"data": {
"errorMessage": "Network error when using Patch function: The specified record was not found.",
"raiseToastNotification": false,
"wasReported": false,
"functionName": "Patch",
"context": {
"entityName": "btn_FormSavee",
"propertyName": "OnSelect",
"id": 13538,
"nodeId": 7,
"diagnosticContext": {
"span": {
"start": 0,
"end": 74
},
"formula": "Patch(OnPremiseSQLDB,dt_DataTable.Selected,\r\n{Notes: DataCardValue46.Text})"
}
},
"info": "Network error when using Patch function: The specified record was not found."
}
}