Summary
AddObjectArray()
CreateObject()
InvokeCreate()
InvokeDelete()
InvokeExecute()
InvokePerform()
InvokeRetrieve()
InvokeUpdate()
SetObjectProperty()
Invokes the Delete method on a Marketing Cloud Engagement API Object and returns the API status code. Use an ID, external ID, or key as the object reference.
| Marketing Cloud Engagement | ✅ Yes |
| Marketing Cloud Next | ❌ No |
1InvokeDelete(apiObject,
2 statusMessage,
3 errorCode,
4 deleteOptionsObject)The InvokeDelete() function has four parameters:
apiObject (API Object): Required. The API Object to delete.statusMessage (AMPscript variable): Required. An AMPscript variable that stores the API status message.errorCode (AMPscript variable): Required. An AMPscript variable that stores the API error code.deleteOptionsObject (API Object): A DeleteOptions API object.This example creates a Subscriber API Object and sets a property on it. It then deletes the Object and outputs the status code. If the status code doesn’t equal “OK,” it outputs the status message and error code.
1%%[
2 var @sub, @statusCode, @statusMessage, @errorCode
3 set @sub = CreateObject("Subscriber")
4
5 SetObjectProperty(@sub, "CustomerKey", "4231")
6
7 set @statusCode = InvokeDelete(@sub, @statusMessage, @errorCode)
8]%%
9
10<p>Status Code: %%=v(@statusCode)=%%</p>
11
12%%[If @statusCode != "OK" then]%%
13<p>Status Message: %%=v(@statusMessage)=%%</p>
14<p>Error Code: %%=v(@errorCode)=%%</p>
15%%[EndIf]%%