AddObjectArrayItem
→ voidAppends an item to an array property on a SOAP API object. Used together with CreateObject and SetObjectProperty to build complex SOAP request payloads.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.AddObjectArrayItem(apiObject, propertyName, value)
3 arguments
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
apiObject |
object | Yes | SOAP API object instance created with CreateObject |
propertyName |
string | Yes | Name of the array property to append to |
value |
any | Yes | Item to append to the array property |
Examples
// Build a TriggeredSend request with multiple subscribers
var sendDef = Platform.Function.CreateObject("TriggeredSend");
Platform.Function.SetObjectProperty(sendDef, "TriggeredSendDefinition", tsd);
var sub = Platform.Function.CreateObject("Subscriber");
Platform.Function.SetObjectProperty(sub, "EmailAddress", "jane@example.com");
Platform.Function.SetObjectProperty(sub, "SubscriberKey", "sub_jane");
Platform.Function.AddObjectArrayItem(sendDef, "Subscribers", sub);
var status = "";
var code = "";
var msg = "";
Platform.Function.InvokeCreate(sendDef, status, code, msg);
For most SOAP-based operations, WSProxy is significantly simpler. Prefer WSProxy over the CreateObject/AddObjectArrayItem/Invoke pattern for new code.