Newer Version Available
create()
This call can be used to create any of the objects that extend Metadata. For more details, see Metadata Components and Types.
Syntax
1AsyncResult[] = metadatabinding.create(Metadata[] metadata);Usage
Use this call to add one or more metadata components to your organization.
Version
This call is available in API version 30.0 and earlier only. This call is not available in API version 31.0 and later. Use createMetadata() instead.
Required Fields
Required fields are determined by the metadata components being created. For more information about specific component types, see Metadata Components and Types.
Valid Data Values
You must supply values that are valid for the field’s data type, such as integers for integer fields (not alphabetic characters). In your client application, follow the data formatting rules specified for your programming language and development tool (your development tool handles the appropriate mapping of data types in SOAP messages).
String Values
When storing values in string fields, the API trims any leading and trailing whitespace. For example, if the value of a label field is entered as "MyObject " the value is stored in the database as "MyObject".
Basic Steps for Creating Metadata Components
Use the following process to create metadata components:
- Design an array and populate it with the components you want to create. All components must be of the same type.
- Call create() with the component array passed in as an argument.
- An AsyncResult object is returned for each component you triy to create, and is updated with status information as the operation moves from a queue to completed or error state. Call checkStatus() in a loop until the status values in AsyncResult indicate that all create operations are completed. Start with a wait time of one second between iterations of checkStatus() calls, and double the wait time each time you make a subsequent call.
Sample Code—Java
See Step 3: Walk through the Java Sample Code for sample Java code using the create() call.
Arguments
| Name | Type | Description |
|---|---|---|
| metadata | Metadata[] |
Array of one or more metadata components. You must submit arrays of only one type of component. For example, you could submit an array of 10 custom objects or 10 profiles, but not a mix of both types. |