# UpdateMscrmRecords()

Updates one or more records in a Microsoft Dynamics CRM entity, and returns the number of successfully updated records.

## Availability

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

## Syntax

```
UpdateMscrmRecords(entityName, guidsToUpdate,
                   attributeName1, attributeValue1,
                   [attributeName2, attributeValue2] ... )
```

The `UpdateMscrmRecords()` function has four parameters:

- `entityName` (string): Required. The name of the Microsoft Dynamics CRM entity that contains the records to update.
- `guidsToUpdate` (string): Required. A comma-separated list of GUIDs to update.
- `attributeName1` (string): Required. The name of the attribute to update on the target records.
- `attributeValue1` (string): Required. The attribute value to update on the target records.

You can pass multiple name-value pairs for attributes by appending them to the end of the function (`attributeName2, attributeValue2 ...`).

## Usage

This example changes the value of the Lead Source Code attribute to "Web" for several records.

```
%%[
  Var @records_updated
  Set @records_updated = updatemscrmrecords('lead',
                                            '32fbb843-7f72-4284-9800-78b87fbbd2ad,5505d40a-3503-4208-b842-43ff8c2d997c',
                                            'leadsourcecode', '8')
]%%
<p>Count of records updated: %%=v(@records_updated)=%%</p>
```

The example outputs the number of updated records.
