Skip to content

Commit d946718

Browse files
authored
Update entity-operations-update-delete.md
Add Important note about behaviors of update statecode without statuscode
1 parent 4e87d65 commit d946718

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

powerapps-docs/developer/data-platform/org-service/entity-operations-update-delete.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ Each of the examples uses a `svc` variable that represents an instance of a clas
2929
>
3030
> You should create a new `Entity` instance, set the id attribute and any attribute values you are changing, and use that entity instance to update the table row.
3131
32+
> [!IMPORTANT]
33+
> 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.
34+
> 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.
35+
> ```csharp
36+
> var row = new Entity("incident", new Guid("ac1f2a46-6351-44f0-b42f-a478a2bb6e06"));
37+
> row["statecode"] = 0; //active
38+
> organizationService.Update(row);
39+
> ```
40+
> 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.
41+
3242
> [!NOTE]
3343
> The column definition includes a `RequiredLevel` property. When this is set to `SystemRequired`, you cannot set these columns to a null value. If you attempt this you will get error code `-2147220989` with the message `Attribute: <attribute name> cannot be set to NULL`.
3444
>
@@ -400,4 +410,4 @@ More information: [Behavior of specialized update operations](../special-update-
400410
[Retrieve a table row using the Organization Service](entity-operations-retrieve.md)<br />
401411
[Associate and disassociate table rows using the Organization Service](entity-operations-associate-disassociate.md)<br />
402412

403-
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
413+
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)