Runtime verified Test scripts included

Syntax

InvokeExecute(executeRequest[, @statusMessage, @requestId])  →  rowset
1–3 arguments

Runs the SOAP Execute verb on an ExecuteRequest built with CreateObject. Returns a rowset of per-item results; the OverallStatus and a RequestID GUID go to out-variables.

Parameters

Name Type Required Description
executeRequest object Yes An ExecuteRequest whose Name is the verb to run
@statusMessage string No Out-variable that receives the OverallStatus
@requestId string No Out-variable that receives the RequestID GUID

Example

%%[
  VAR @er, @st, @req, @rows
  SET @er = CreateObject("ExecuteRequest")
  SetObjectProperty(@er, "Name", "SomeExecuteVerb")
  SET @rows = InvokeExecute(@er, @st, @req)
  OutputLine(Concat("rowCount=[", RowCount(@rows), "] st=[", @st, "] req=[", @req, "]"))
]%%

For an unknown verb this renders rowCount=[1] st=[Error] req=[<guid>], and row 1 carries StatusCode=[Error] StatusMessage=[Unable to find a handler for the SomeExecuteVerb method.] ErrorCode=[0].

Return value

rowset — the Results, one row per item, each exposing StatusCode, StatusMessage and ErrorCode. The @statusMessage out-variable receives the OverallStatus and @requestId receives a RequestID GUID.

Behaviour

The return is a rowset, not a status string. Read each result with Row(@rows, n) and Field(@row, "StatusCode" / "StatusMessage" / "ErrorCode"). This differs from the create/update/delete executors, which return the OverallStatus directly.

An unrecognised verb is reported in the result row, not by aborting. Calling an unknown verb returned a single result row with StatusCode=Error and a StatusMessage naming the missing handler — the page still rendered HTTP 200.

The two out-variables are optional and independent. InvokeExecute(@er) with no out-variables still runs and returns the rowset; supplying only @statusMessage (InvokeExecute(@er, @st)) populates it while leaving the RequestID unread. Both one- and two-argument forms rendered at HTTP 200 alongside the full three-argument call.

Show test script
%%[
  VAR @b, @er, @st, @req, @rc
  SET @b = RequestParameter("b")
  SET @er = CreateObject("ExecuteRequest")
  SetObjectProperty(@er, "Name", "NotARealExecuteVerbZZ")

  /* a1: out-variable pair omitted - proves min_args is 1 */
  IF @b == "a1" THEN
    OutputLine(Concat("--- a1 start ---"))
    SET @rc = InvokeExecute(@er)
    OutputLine(Concat("a1 rowCount=[", RowCount(@rc), "]"))
    OutputLine(Concat("--- a1 done ---"))
  ENDIF

  /* a2: only the statusMessage out-variable supplied */
  IF @b == "a2" THEN
    OutputLine(Concat("--- a2 start ---"))
    SET @rc = InvokeExecute(@er, @st)
    OutputLine(Concat("a2 rowCount=[", RowCount(@rc), "] st=[", @st, "]"))
    OutputLine(Concat("--- a2 done ---"))
  ENDIF

  /* a3: full form - both out-variables receive OverallStatus and the RequestID GUID */
  IF @b == "a3" THEN
    OutputLine(Concat("--- a3 start ---"))
    SET @rc = InvokeExecute(@er, @st, @req)
    OutputLine(Concat("a3 rowCount=[", RowCount(@rc), "] st=[", @st, "] req=[", @req, "]"))
    OutputLine(Concat("--- a3 done ---"))
  ENDIF
]%%

Availability

Platform Available
Marketing Cloud Engagement Yes
Marketing Cloud Next No

See also