create()

Adds one or more new metadata components to your organization’s data. This call can be used to create any of the objects that extend Metadata. For more details, see Metadata Components and Types.

Syntax

AsyncResult[] = metadatabinding.create(Metadata[] metadata);

Usage

Use this call to add one or more metadata components to your organization’s information.

Permissions

Your client application must be logged in with the “Modify All Data” permission.

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 (not alphabetic characters) for integer fields. In your client application, follow the data formatting rules specified for your programming language and development tool (your development tool will handle 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:

  1. Design an array and populate it with the components that you want to create.
  2. Call create() with the component array passed in as an argument.
  3. An AsyncResult object is returned for each component you tried to create. It 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 the 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 4: Walk Through the Sample Code for sample Java code using the create() call.

Arguments

Name Type Description
metadata Metadata[]

Array of one or more metadata components.

Limit: 10.

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.

Response

AsyncResult[]

© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.