8

There are no examples on the usage of the InvokePerform() AMPScript function in the official documentation -- at least that I can find.

Doing some testing and comparing the usage to the SOAP API, I noticed there are three more valid arguments. Here's my code to start a QueryDefinition:

%%[

var @rr, @objectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "QueryDefinition")
AddObjectArrayItem(@rr, "Properties", "ObjectID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "CustomerKey")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "DataExtensionTest")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("QueryDefinition")

  SetObjectProperty(@obj, "ObjectID", @ObjectID )
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage, @unknown1, @unknown2, @performResult)

endif

]%%
queryDefinitions: %%=rowcount(@queryDefinitions)=%%
<br>performStatusCode: %%=v(@performStatusCode)=%%
<br>performStatusMessage: %%=v(@performStatusMessage)=%%
<br>unknown1: %%=v(@unknown1)=%%
<br>unknown2: %%=v(@unknown2)=%%
<br>performResult: %%=v(@performResult)=%%

Output

queryDefinitions: 1 
performStatusCode: OK 
performStatusMessage: QueryDefinition perform called successfully 
unknown1: 0 
unknown2: 
performResult: ExactTarget.Integration.WSDL.PerformResult

Anyone know what @unknown1 and @unknown2 represent?

I also can't figure out for the life of me how to retrieve the values returned in the PerformResult. If anyone has some insight on that, I'd love to know.

  • From an initial look unknown1 could be an error code, 0 meaning OK in API terms. unknown2 could be last error code which has references in the Core library. I'll do some more digging and report back. – Amtera Jan 10 '18 at 14:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.