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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CRUD-Based Callsdelete<strong>Metadata</strong>()co.setDescription("Updated description");co.setLabel(name + " Object Update");co.setPluralLabel(co.getLabel() + "s");co.setSharingModel(SharingModel.ReadWrite);// Name field with a type and label is requiredCustomField cf = new CustomField();cf.setType(FieldType.Text);cf.setLabel(co.getFullName() + " Name");co.setNameField(cf);SaveResult[] results = metadataConnection.update<strong>Metadata</strong>(new <strong>Metadata</strong>[] { co });}for (SaveResult r : results) {if (r.isSuccess()) {System.out.println("Updated <strong>com</strong>ponent: " + r.getFullName());} else {System.out.println("Errors were encountered while updating "+ 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 you wish to update.Limit: 10.You must submit arrays of only one type of <strong>com</strong>ponent. For example,you could submit an array of 10 custom objects or 10 profiles, butnot a mix of both types.ResponseSaveResult[]delete<strong>Metadata</strong>()Deletes one or more metadata <strong>com</strong>ponents from your organization synchronously.SyntaxDeleteResult[] = metadataConnection.delete(string metadataType, string[] fullNames);UsageUse the delete<strong>Metadata</strong>() call to delete 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 delete any of the objects that extend <strong>Metadata</strong>. For more details, see <strong>Metadata</strong> Components and Types.51

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

Saved successfully!

Ooh no, something went wrong!