What does “version” do in package.xml in Salesforce?

If you have worked with package.xml in Salesforce to retrieve or deploy components, you have seen the “<version></version>” tag. Do you know what exactly it does?

Version determines which version of Metadata API Salesforce will use to retrieve or deployment your components. And that will mean that only those properties will be retrieved or deployed that was available in that version.

Here is a package.xml file that I used to retrieve the same component (one custom object and one custom profile) with different versions. The Org that I used is currently on Winter ’22 Release of Salesforce (i.e. version 53.0)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <members>AA System Administrator</members>

I retrieved the metadata using above package.xml with version 10.0 & 20.0. And here is the difference between the XMLs produced by these versions. As you can see, new objects specific permissions were available in version 20.0, which was not available in version 10.0

Purpose of version in package.xml in Salesforce

And here is the difference between the XMLs produced by versions 40.0 & 53.0. Looks like not a lot changed between these two versions on the profile (this of course is in relation to the metadata that were retrieved along with the profile)

Purpose of version in package.xml in Salesforce

This also means that you should be able to retrieve the metadata extracted with one version and deploy it using another version, as long the all the metadata properties are supported in both versions. 

If not, then trying to deploy metadata with a version that is different than what was used to retrieve it will throw an error like this. In this example, I was trying to deploy the custom object and custom profile using version 53.0, that was retrieved using version 20.0.

Purpose of version in package.xml in Salesforce

But deploying it using version 20.0 worked just fine.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Introducing All Access Pass