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 Callsrename<strong>Metadata</strong>()NamefullNamesTypestring[]DescriptionArray of full names of the <strong>com</strong>ponents to delete.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.ResponseDeleteResult[]rename<strong>Metadata</strong>()Renames a metadata <strong>com</strong>ponent in your organization synchronously.SyntaxSaveResult = metadataConnection.rename<strong>Metadata</strong>(string metadataType, String oldFullname,String newFullname);UsageUse the rename<strong>Metadata</strong>() call to rename one metadata <strong>com</strong>ponent in your organization. This call executes synchronously,meaning the call returns only when the operation <strong>com</strong>pletes.You can use this call to rename 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.PermissionsYour client application must be logged in with the “Modify All Data” permission.Basic Steps for Renaming <strong>Metadata</strong> ComponentsUse the following process to rename a metadata <strong>com</strong>ponent:1. Determine the metadata type of the <strong>com</strong>ponent you want to rename, its current full name, and the new full name. See<strong>Metadata</strong> for more details on the fullName field.2. Invoke the rename<strong>Metadata</strong>() call. For the first argument, pass in the name of the metadata type. Pass in the old fullname as the second argument and the new full name as the last argument.A SaveResult object is returned that contains information about whether the operation was successful, the name of therenamed <strong>com</strong>ponent (which is the new name if the renaming was successful), and any errors returned if the operationwasn’t successful.Sample Code—Javapublic void renameCustomObjectSync() {try {SaveResult[] results = metadataConnection.rename<strong>Metadata</strong>("CustomObject", "MyCustomObject1__c","MyCustomObject1New__c");for (SaveResult r : results) {53

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

Saved successfully!

Ooh no, something went wrong!