AMPscript
Add
Retrieve
Validate Your Server-Side JavaScript using WSProxy
Creates a data extension and returns an initialized DataExtension object.
Add(1)
| Ordinal | Type | Description |
|---|---|---|
1 | Object | Required. An object that specifies the properties of the new data extension. |
This code example creates a sendable data extension that contains four fields. The field SubKey is associated with the contact’s subscriber key.
1var deObj = {
2 CustomerKey : "SendableDE",
3 Name : "Sendable Data Extension",
4 Fields : [
5 { "Name" : "SubKey", "FieldType" : "Text", "IsPrimaryKey" : true, "MaxLength" : 50, "IsRequired" : true },
6 { "Name" : "SecondField", "FieldType" : "Text", "MaxLength" : 50 },
7 { "Name" : "ThirdField", "FieldType" : "Text", "MaxLength" : 50 },
8 { "Name" : "DifferentSubKey", "FieldType" : "Text", "MaxLength" : 50 }
9 ],
10 SendableInfo : {
11 Field : { "Name" : "SubKey", "FieldType" : "Text" },
12 RelatesOn : "Subscriber Key"
13 }
14};
15
16var de = DataExtension.Add(deObj);For information about specifying data extension fields, see Fields.Add.