Newer Version Available

This content describes an older version of this product. View Latest

AllOrNoneHeader

Indicates whether to roll back all metadata changes when some of the records in a call result in failures.

Version

This header is available in API version 34.0 and later.

Usage

If this header isn’t used in API version 34.0 and later, by default a call can save a partial set of records (equivalent to AllOrNoneHeader=false)—the records that are processed successfully are saved and records that have failures aren’t saved.

Fields

Field Name Type Description
allOrNone boolean Set to true to cause all metadata changes to be rolled back if any records in the call cause failures. Set to false to enable saving only the records that are processed successfully when other records in the call cause failures.

Sample Code—Java

Add the AllOrNoneHeader to the metadata connection before you perform a call as follows:

This next example shows how to use the AllOrNoneHeader when creating two custom objects. Because the second custom object doesn’t have the required Name field, the create() call can’t create this custom object and rolls back the first custom object. The output is shown after this code sample.

This is the output that the sample returns. The first record is rolled back and the second has a failure.