add()

Adds one or more new objects.

Syntax

            UpdateResult[] addResults = stub.add(new oaBase[] objects); 

          

Usage

Use the add() command to add one or more new objects. The maximum number of objects you can add with one single call is 1,000.

The add() command cannot be used to add User objects. Use createUser() instead.

You can set custom field values as well as standard field values when adding objects. See Reading or Setting Custom Field Values Inline.

Arguments

Name

Type

Description

objects

oaBase[]

Array of oaBase objects

Response

UpdateResult[] — Array of UpdateResult objects.

Sample Code — C#

            //Define a category object to create in OpenAir
oaCategory category = new oaCategory();
category.name = "New Category";
category.cost_centerid = "123";
category.currency = "USD";

//Invoke the add call
UpdateResult[] results = _svc.add(new oaBase[] { category });

//Get the new ID
string newID = results[0].id; 

          

Sample Code — Java

            // Create a category object to send to the service
oaCategory category = new oaCategory();

// Set several properties
category.setName("my new category");

// Add the category to an array of oaBase objects
oaBase[] records = new oaBase[] { category };

// Invoke the add call
UpdateResult[] results = stub.add(records);

// Get the new ID
String newID = results[0].getId();