12.07.2015 Views

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CRUD-Based Callsread<strong>Metadata</strong>()nf.setType(FieldType.Text);nf.setLabel(co.getFullName() + " Name");co.setNameField(nf);SaveResult[] results = metadataConnection.create<strong>Metadata</strong>(new <strong>Metadata</strong>[] { co });}for (SaveResult r : results) {if (r.isSuccess()) {System.out.println("Created <strong>com</strong>ponent: " + r.getFullName());} else {System.out.println("Errors were encountered while creating "+ r.getFullName());for (Error e : r.getErrors()) {System.out.println("Error message: " + e.getMessage());System.out.println("Status code: " + e.getStatusCode());}}}} catch (ConnectionException ce) {ce.printStackTrace();}ArgumentsNamemetadataType<strong>Metadata</strong>[]DescriptionArray of one or more metadata <strong>com</strong>ponents.Limit: 10.You must submit arrays of only one type of <strong>com</strong>ponent. For example, you could submitan array of 10 custom objects or 10 profiles, but not a mix of both types.ResponseSaveResult[]read<strong>Metadata</strong>()Returns one or more metadata <strong>com</strong>ponents from your organization synchronously.SyntaxReadResult = metadataConnection.read<strong>Metadata</strong>(string metadataType, string[] fullNames);UsageUse the read<strong>Metadata</strong>() call to get one or more metadata <strong>com</strong>ponents from your organization. This call executessynchronously, meaning the call returns only when the operation <strong>com</strong>pletes.You can use this call to retrieve any of the objects that extend <strong>Metadata</strong>. For more details, see <strong>Metadata</strong> Components andTypes.VersionAvailable in <strong>API</strong> version 30.0 and later.48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!