CreateObject
→ objectCreates an SFMC SOAP API object by its API type name. Used in conjunction with SetObjectProperty and InvokeCreate/Retrieve/Update/Delete for low-level SOAP operations.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.CreateObject(objectType)
1 argument
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
objectType |
string | Yes | SFMC SOAP API type name (e.g., "DataExtensionObject", "Subscriber") |
Examples
// Create a DataExtensionObject for upsert
var deObject = Platform.Function.CreateObject("DataExtensionObject");
Platform.Function.SetObjectProperty(deObject, "CustomerKey", "MyDE_Key");
var fieldProps = Platform.Function.CreateObject("APIProperty");
Platform.Function.SetObjectProperty(fieldProps, "Name", "Email");
Platform.Function.SetObjectProperty(fieldProps, "Value", "test@example.com");
var status = "";
var code = "";
var message = "";
var result = Platform.Function.InvokeCreate(deObject, status, code, message);
For most SOAP-based operations, WSProxy is significantly simpler to use. Prefer WSProxy over CreateObject/Invoke patterns for new code.