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)


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


queryDefinitions: 1 
performStatusCode: OK 
performStatusMessage: QueryDefinition perform called successfully 
unknown1: 0 
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

There is a bit more information found in the AMPscript Guide

| improve this answer | |
  • 1
    LOL. I'm the co-author of The AMPscript Guide. I asked this question for the book! – Adam Spriggs May 31 '19 at 21:02
  • That's pretty amazing, and now I feel I have deserved this. Feel free to downvote me. :) – Spencer Curtis May 31 '19 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.