Newer Version Available
Deploying and Retrieving Metadata
Use the deploy() and retrieve() calls to move metadata (XML files) between a Salesforce organization and a local file system. After you retrieve your XML files into a file system, you can manage changes in a source-code control system, copy and paste code or setup configurations, diff changes to components, and perform many other file-based development operations. At any time you can deploy those changes to another Salesforce organization.
Data in XML files is formatted using the English (United States) locale. This formatting ensures that fields that depend on locale, such as date fields, are interpreted consistently during data migrations between organizations using different languages. Organizations can support multiple languages for presentation to their users.
The deploy() and retrieve() calls are used primarily for the following development scenarios:
- Development of a custom application (or customization) in a sandbox organization. After development and testing are completed, the application or customization is then deployed into a production organization using Metadata API.
- Team development of an application in a Developer Edition organization. After development and testing are completed, you can then distribute the application via Lightning Platform AppExchange.
You receive an API notification each time you retrieve 90% or more of the maximum number of custom fields that you can deploy at once with Metadata API. The maximum number of custom fields for one deployment is 45,000. The custom fields retrieved in one package.xml file are: 1) the sum of the fields on each object in the CustomObjects section of package.xml and 2) the sum of the custom fields in the CustomFields section of package.xml.
You can still retrieve above the deployable maximum up to the limit on total size of retrieved files. But you must use more than one deployment to deploy all of the custom fields.