You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/use-upsert-insert-update-record.md
+23-26Lines changed: 23 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Use Upsert to insert or update a record (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
3
description: "UpsertRequest(Update or Insert) message helps you simplify various data integration scenarios where you do not know if a record already exists in Microsoft Dataverse. In such cases you won’t know if you should call an UpdateRequest or a CreateRequest operation. This results in your querying for the record first to determine if it exists before performing the appropriate operation. UpsertRequest message helps you solve that issue"# 115-145 characters including spaces. This abstract displays in the search result.
4
-
ms.date: 03/22/2022
4
+
ms.date: 04/08/2022
5
5
ms.reviewer: "pehecke"
6
6
ms.topic: "article"
7
7
author: "divka78"# GitHub ID
@@ -25,44 +25,47 @@ You can reduce the complexity involved with data integration scenarios by using
25
25
26
26
<aname="BKMK_UsingUpsert"></a>
27
27
28
-
## Using Upsert
28
+
## Using Upsert
29
+
29
30
It is best to use <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> only when you aren’t sure if the record exists. That is, when you aren’t sure if you should call a <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> or an <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest> operation. There is a performance decrease in using <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> versus using <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest>. If you are sure the record doesn’t exist, use <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest>.
30
31
31
-
The <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> includes a property named <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest.Target>. This property contains the table definition that will be used in an <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest> or a <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> operation. It also includes all the columns required by the <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> for the target table type so that the record can be created if it doesn’t exist.
32
+
The <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> includes a property named <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest.Target>. This property contains the entity instance that will be used in an <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest> or a <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> operation. It also includes all the columns required by the <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> for the target entity so that the record can be created if it doesn’t exist.
32
33
33
34
You can inspect <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.RecordCreated> to determine if the record was created. <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.RecordCreated> will be true if the record didn’t exist and was created. It will be false if the record already existed and was updated. <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.Target> will be an `EntityReference` to the record that was found to exist or to the record that was created.
34
35
35
36
To understand how <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> works, see the following section.
36
37
37
-
<aname="BKMK_upsert"></a>
38
+
<aname="BKMK_upsert"></a>
39
+
38
40
## Understanding the Upsert process
41
+
39
42
The following steps describe the processing logic when an <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> is received:
40
43
41
44
1. Send <xref:Microsoft.Xrm.Sdk.Messages.UpsertRequest> with enough data for a create or insert operation.
42
45
43
-
2. Dataverse will look up the record targeted by the target table.
46
+
2. Dataverse will look up the record targeted by the target entity.
44
47
45
48
3. If the record exists:
46
49
47
-
1. Set the ID property of the target table with the ID of the found record.
50
+
1. Set the ID property of the target entity with the ID of the found record.
48
51
49
52
2. Call Update.
50
53
51
54
3. Set the <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.RecordCreated> to `false`.
52
55
53
-
4. Create an <xref:Microsoft.Xrm.Sdk.EntityReference> from the target table of the update as the value for <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.Target>.
56
+
4. Create an <xref:Microsoft.Xrm.Sdk.EntityReference> from the target entity of the update as the value for <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.Target>.
54
57
55
58
5. Return the <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse>.
56
59
57
60
4. If the record doesn’t exist:
58
61
59
-
1. Copy any alternate key values that the target does not already have in its attributes collection, into the target table columns.
62
+
1. Copy any alternate key values that the target does not already have in its attributes collection, into the target entity attributes.
60
63
61
64
2. Call `Create`.
62
65
63
66
3. Set the <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.RecordCreated> to `true`.
64
67
65
-
4. Create an <xref:Microsoft.Xrm.Sdk.EntityReference> from the target table type and the ID result of the `Create` request as the value for <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.Target>.
68
+
4. Create an <xref:Microsoft.Xrm.Sdk.EntityReference> from the target entity and the ID result of the `Create` request as the value for <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse.Target>.
66
69
67
70
5. Return the <xref:Microsoft.Xrm.Sdk.Messages.UpsertResponse>.
68
71
@@ -72,11 +75,12 @@ You can reduce the complexity involved with data integration scenarios by using
72
75
73
76
<aname="BKMK_SampleCode"></a>
74
77
75
-
## Sample code
76
-
The [Insert or update a record using Upsert](/samples/browse/) sample [ProductUpsertSample.cs](https://code.msdn.microsoft.com/Insert-or-update-a-record-aa160870/sourcecode?fileId=136218&pathId=1243320355) file contains the following `ProcessUpsert` method to apply the `UpsertRequest` message on the contents of an XML file to create new records or update existing ones.
78
+
## Sample code
79
+
80
+
The [SampleMethod.cs](https://github.com/microsoft/PowerApps-Samples/blob/master/cds/orgsvc/C%23/InsertRecordUsingUpsert/InsertRecordUsingUpsert/SampleMethod.cs) file in the [Insert record using Upsert](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23/InsertRecordUsingUpsert/InsertRecordUsingUpsert) sample contains the following `ProcessUpsert` method to apply the `UpsertRequest` message on the contents of an XML file to create new records or update existing ones.
Copy file name to clipboardExpand all lines: powerapps-docs/mobile/powerapps-mobile-troubleshoot.md
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,22 @@ To resolve connection related issues, ensure you remain connected to the interne
126
126
127
127
The Flow action menu in Power Apps mobile doesn't support flows created in a solution.
128
128
129
+
## App resets when running it on Power Apps mobile
130
+
131
+
When you run a canvas or model-driven app on Power Apps mobile it can reset if the app is using too many resources. If the app uses more resources than are available on your device, the app will reset. This is similar to when you visit a large complex webpage, and the web browser suspends the page because it is consuming too much power.
132
+
133
+
Power Apps mobile is designed to run on a wide range of devices, including low-end devices with limited resources. When you create a canvas or model-driven app, remember to optimize the app to run on the lowest specificized device that your end-users will use.
134
+
135
+
If you experience a reset, contact your app developer, and point them to this topic.
136
+
137
+
For more information for developers, see:
138
+
139
+
- Blog post: [PowerApps coding standards and guidelines](https://powerapps.microsoft.com/blog/powerapps-canvas-app-coding-standards-and-guidelines/)
140
+
- Whitepaper: [PowerApps canvas app coding
141
+
standards and guidelines](https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf) (Note, review the section titled, **Optimizing for performance**).
142
+
143
+
144
+
129
145
### See also
130
146
131
147
[Power Apps portals known issues](../maker/portals/known-issues.md) <br/>
0 commit comments