---
schema_version: "1"
id: ce4b0736d14cf6773792bb9b72dc06251617bf7f5e93632acf5b466c5c346015
title: UpdateMscrmRecords()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/microsoft-dynamics-crm/mc-ampscript-reference-microsoft-dynamics-crm-update-records.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-mscrm/mc-ampscript-reference-microsoft-dynamics-crm-update-records.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 268876d484239af40b6904428b77b809c439651ed9796ef0fbec9efffc3af4c3
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# 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.

<!-- The GUIDs used in this example are randomly generated and do not represent a security risk. -->

```
%%[
  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.
