---
schema_version: "1"
id: 10ecfd1a800abd7d85769c2db671379b1a603180efeb260acac330f87eee4cc4
title: InvokeUpdate()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/api/mc-ampscript-reference-api-invoke-update.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-update.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7e767aab5648393a2516c842643776f41e97f67dfaebadb7f2a8cbc502f9a43c
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# InvokeUpdate()

Invokes the Update method on an API object.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```InvokeUpdate(apiObject,
                statusMessage,
                errorCode,
                updateOptions)
```

The `InvokeUpdate()` function has four parameters:

- `apiObject` (API object): Required. The API object to update.
- `statusMessage` (AMPscript variable): An AMPscript variable that stores the API status message.
- `errorCode` (AMPscript variable): An AMPscript variable that stores the response error code (if one occurs).
- `updateOptions` (API object): An [UpdateOptions](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/updateoptions.htm) API object.

## Usage

This example creates a new Subscriber object and sets the `EmailAddress` and `SubscriberKey` values. Next, it creates a new ClientId object, sets the value of `ID`, and associates the ClientId object with the Subscriber object. After that, it calls the `InvokeUpdate()` function to perform the update operation.

```
%%[
  Set @sub = CreateObject("Subscriber")
  SetObjectProperty(@sub,"EmailAddress", @email)
  SetObjectProperty(@sub,"SubscriberKey", @subkey)
  SetObjectProperty(@sub,"Status","Active")

  Set @cid = CreateObject("ClientID")
  SetObjectProperty(@cid, "ID", "1234567")
  SetObjectProperty(@cid, "IDSpecified", "true")
  SetObjectProperty(@sub, "Client", @cid)

  Set @options = CreateObject("UpdateOptions")
  Set @save = CreateObject("SaveOption")
  SetObjectProperty(@save,"SaveAction","UpdateAdd")
  SetObjectProperty(@save,"PropertyName","*")
  AddObjectArrayItem(@options,"SaveOptions", @save)

  Set @update_sub = InvokeUpdate(@sub, @update_sub_status, @update_sub_errorcode, @options)
]%%
<p>Status: %%=v(@update_sub_status)=%%</p>
<p>Error code: %%=v(@update_sub_errorcode)=%%</p>
```

If the function executes successfully, the output includes a status message and an error code of `0`.

```
Status: Updated Subscriber.
Error code: 0
```
