# SetStateMscrmRecord()

Sets the state and status of a Microsoft Dynamics CRM record.

:::note
Some entities, including Opportunity, require special CRM requests to change their state. This function doesn’t work for those entities.
:::

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```
SetStateMscrmRecord(recordGuid, entityName,
                    stateToSet, statusToSet)
```

The `SetStateMscrmRecord()` function has four parameters:

- `recordGuid` (string): Required. The GUID of the record to set the state and status of.
- `entityName` (string): Required. The name of the Microsoft Dynamics CRM entity.
- `stateToSet` (string): Required. The state to set for the record. Accepted values: `active` or `inactive`.
- `statusToSet` (string): Required. The status to set for the record. Accepted values: `0`, `1`, or `-1`. A value of `-1` resets the status to its default value.

## Usage

This example changes the state of an account to inactive.

```
%%[
  SetStateMscrmRecord("679ab01a-e998-4e4f-b5e6-a49bcef99c76", "account", "Inactive", "-1")
]%%
```

The function doesn’t return a value.
