Skip to content

Commit a10e99b

Browse files
authored
Update update-delete-entities-using-web-api.md
Add Important note about behaviors of update statecode without statuscode
1 parent 4e87d65 commit a10e99b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

powerapps-docs/developer/data-platform/webapi/update-delete-entities-using-web-api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ The `If-Match: *` header ensures you don't create a new record by accidentally p
3131
> [!IMPORTANT]
3232
> When updating an entity, only include the properties you are changing in the request body. Simply updating the properties of an entity that you previously retrieved, and including that JSON in your request, will update each property even though the value is the same. This can cause system events that can trigger business logic that expects that the values have changed. This can cause properties to appear to have been updated in auditing data when in fact they haven't actually changed.
3333
34+
> [!IMPORTANT]
35+
> If the `statecode` is being updated, it is important to always pair `statecode` with the desired `statuscode` in update operations. When the `statecode` is updated without specifying a `statuscode`, the first `statuscode` item configured in the list of statuscodes will be used.
36+
> For example, assume a case record has a statuscode of 2 (On Hold). After running the code below, the statuscode will be updated to 1 even if it wasn't specified in the update operation.
37+
> ```http
38+
> PATCH [Organization URI]/api/data/v9.2/incidents(ac1f2a46-6351-44f0-b42f-a478a2bb6e06) HTTP/1.1
39+
> Content-Type: application/json
40+
> OData-MaxVersion: 4.0
41+
> OData-Version: 4.0
42+
> If-Match: *
43+
>
44+
> {
45+
> "statecode": 0
46+
> }
47+
> ```
48+
> Furthermore, if auditing is enabled in the environment, on the table and on the `statuscode` column, there will be no audit logs of the example above since the actual update statement had no `statuscode` specified.
49+
3450
> [!NOTE]
3551
> The definition for attributes includes a `RequiredLevel` property. When this is set to `SystemRequired`, you cannot set these attributes to a null value. More information: [Attribute requirement level](../entity-attribute-metadata.md#column-requirement-level)
3652

0 commit comments

Comments
 (0)