InvokeExecute
→ stringExecutes a SOAP Execute call on a fully configured SOAP API object. Use with CreateObject and SetObjectProperty to perform execute-type actions such as sending triggered emails or running queries.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.InvokeExecute(apiObject, method[, statusMessage, errorCode])
2–4 arguments
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
apiObject |
object | Yes | SOAP object built with CreateObject and configured with SetObjectProperty |
method |
string | Yes | Execute method name to invoke |
statusMessage |
string | No | Variable (passed by reference) that receives the status message |
errorCode |
string | No | Variable (passed by reference) that receives the error code |
Examples
var execObj = Platform.Function.CreateObject("ExecuteRequest");
Platform.Function.SetObjectProperty(execObj, "Name", "LogUnsubEvent");
var status = "";
var code = "";
var result = Platform.Function.InvokeExecute(execObj, "LogUnsubEvent", status, code);
if (code !== "0") {
Write("Error " + code + ": " + status);
}
WSProxy is recommended over InvokeExecute for most use cases — it is simpler, uses native JS objects, and handles serialization automatically.