Summary
AddObjectArray()
CreateObject()
InvokeCreate()
InvokeDelete()
InvokeExecute()
InvokePerform()
InvokeRetrieve()
InvokeUpdate()
SetObjectProperty()
Invokes the Retrieve method on a Marketing Cloud Engagement API Object and returns the API status message and request ID.
| Marketing Cloud Engagement | ✅ Yes |
| Marketing Cloud Next | ❌ No |
1InvokeRetrieve(apiObject,
2 statusMessage,
3 requestId)The InvokeRetrieve() function has three parameters:
apiObject (API Object): Required. The API Object to invoke the Retrieve method on.statusMessage (AMPscript variable): An AMPscript variable that stores the API status message.requestId (AMPscript variable): An AMPscript variable that stores the request ID.This example creates a RetrieveRequest Object, sets a property, and adds an array item. It then creates a simple filter that finds matching email addresses. Finally, the function calls the InvokeRetrieve() function, outputting the status message and the request ID.
1%%[
2 Var @rr_1, @sfp, @statusMessage, @requestId, @emailAddress
3 Set @emailAddress = "john.rosales@example.com"
4 Set @rr_1=CreateObject("RetrieveRequest")
5
6 SetObjectProperty(@rr_1,"ObjectType","Subscriber")
7 AddObjectArrayItem(@rr_1,"Properties","EmailAddress")
8
9 Set @sfp=CreateObject("SimpleFilterPart")
10
11 SetObjectProperty(@sfp,"Property","EmailAddress")
12 SetObjectProperty(@sfp,"SimpleOperator","equals")
13 AddObjectArrayItem(@sfp,"Value",@emailAddress)
14 SetObjectProperty(@rr_1,"Filter",@sfp)
15
16 Set @sub=InvokeRetrieve(@rr_1, @statusMessage, @requestId)
17]%%
18<p>Status message: %%=v(@statusMessage)=%%</p>
19<p>Request ID: %%=v(@requestId)=%%</p>