Update via WSProxy

To update a single item or several items of the same type in a single call, use the updateItem and updateBatch functions.

  • Specify the first two parameters of the update functions like you do for the create functions.
  • The optional third parameter includes any properties to be set using the SOAP UpdateOptions object.

Example 1: Update a Data Extension 

This example renames a data extension using its ObjectID.

1var prox = new Script.Util.WSProxy();
2var objectID = "c9875a80-4dad-e411-b071-ac7ba13db5bc";
3var name = "Renamed DE";
4
5var res = prox.updateItem("DataExtension", { "ObjectID":objectID, "Name":name });

The returned object has the same properties as the Create functions, except the results contain properties from the SOAP UpdateResult items.

Example 2: Upsert to Data Extension 

1var api = new Script.Util.WSProxy();
2
3    /* Build DE Object */
4    var updateObject = {
5        CustomerKey: 'DE_Example',
6        Properties: [
7             {
8                Name: 'FirstName',
9                Value: 'Tester'
10            },
11             {
12                Name: 'LastName',
13                Value: 'Testerson'
14            },
15             {
16                Name: 'ModifiedDate',
17                Value: Platform.Function.Now()
18            }
19        ]
20    };
21
22    var options = {SaveOptions: [{'PropertyName': '*', SaveAction: 'UpdateAdd'}]};
23
24    var res = api.updateItem('DataExtensionObject', updateObject, options);

Related Items 

Create via WSProxy