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.

Show test script
%%[
  VAR @b
  SET @b = RequestParameter("b")

  IF @b == "zzz" THEN
    OutputLine(Concat("CTRL=[alive]"))
  ENDIF

  IF @b == "exec" THEN
    VAR @er, @st, @req, @rc
    SET @er = CreateObject("ExecuteRequest")
    SetObjectProperty(@er, "Name", "NotARealExecuteVerbZZ")
    SET @rc = InvokeExecute(@er, @st, @req)
    OutputLine(Concat("exec rowCount=[", RowCount(@rc), "] st=[", @st, "]"))
    IF RowCount(@rc) > 0 THEN
      VAR @row
      SET @row = Row(@rc, 1)
      OutputLine(Concat("row StatusCode=[", Field(@row, "StatusCode"), "] StatusMessage=[", Field(@row, "StatusMessage"), "] ErrorCode=[", Field(@row, "ErrorCode"), "]"))
    ENDIF
  ENDIF
]%%

Availability

Platform Available
Marketing Cloud Engagement Yes
Marketing Cloud Next No

See also