HOW TO RETRIEVE ALL METADATA FROM SALESFORCE ORG BY PACKAGE.XML
This manifest contains a collection of metadata components and identifies them by their application programming interface (API) names, listing every component by type and corresponding with each metadata file.
A manifest file can include multiple <types> elements so you could combine the individual samples into one package.xml manifest file if you want to work with all the metadata in one batch.
Steps:
- Create a new package.xml file in the root of your project.
- Define the types of metadata that you want to retrieve/deploy in package.xml.
- The
<members>
element specifies the metadata components that you want to retrieve, and the<name>
element specifies the type of metadata. - The
*
wildcard is used to retrieve all components and all types of metadata. - You can retrieve components from salesforce by Salesforce CLI and workbench.
- To retrieve all metadata from a Salesforce org, you will need to include the following elements in your package.xml file
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>*</name>
</types>
<version>56.0</version>
</Package>
Retrieve Profile, Roles, Queues, Groups, Permission Set:-
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Sample Profile Name</members>
<name>Profile</name>
</types>
<types>
<members>SampleRoleName</members>
<name>Role</name>
</types>
<types>
<members>SampleQueueName</members>
<name>Queue</name>
</types>
<types>
<members>SamplePermissionSet</members>
<name>PermissionSet</name>
</types>
<types>
<members>SampleGroup</members>
<name>Group</name>
</types>
<version>57.0</version>
</Package>
Retrieve Email Template & Workflow:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>FolderName/SampleEmailTemplateName</members>
<name>EmailTemplate</name>
</types>
<types>
<members>SampleWorkflow</members>
<name>Workflow</name>
</types>
<version>57.0</version>
</Package>
Retrieve Flow and Process Builder Process :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleProcessName</members>
<members>SampleFlowName</members>
<name>Flow</name>
</types>
<version>57.0</version>
</Package>
Retrieve Custom Object and fields :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleCustomObject</members>
<name>CustomObject</name>
</types>
<types>
<members>ObjectName.CustomFieldName</members>
<name>CustomField</name>
</types>
<version>57.0</version>
</Package>
Retrieve Custom Metadata :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>CustomMetadataName.SampleRecord</members>
<name>CustomMetadata</name>
</types>
<version>57.0</version>
</Package>
Retrieve Custom Label :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleCustomLabel</members>
<name>CustomLabels</name>
</types>
<version>57.0</version>
</Package>
Retrieve Visualforce Page :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleVFPage</members>
<name>ApexPage</name>
</types>
<version>57.0</version>
</Package>
Retrieve Apex Trigger :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleTrigger</members>
<name>ApexTrigger</name>
</types>
<version>57.0</version>
</Package>
Retrieve Apex Class :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleApexClass</members>
<name>ApexClass</name>
</types>
<version>57.0</version>
</Package>
Retrieve Lightning Aura Component :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleAuraComponent</members>
<name>AuraDefinitionBundle</name>
</types>
<version>57.0</version>
</Package>
Retrieve LWC Component :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleLWC</members>
<name>LightningComponentBundle</name>
</types>
<version>57.0</version>
</Package>
Retrieve Tabs and Quick Actions :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleTab</members>
<name>CustomTab</name>
</types>
<types>
<members>ObjectName.SampleQuickAction</members>
<name>QuickAction</name>
</types>
<version>57.0</version>
</Package>
Retrieve Lightning Message Channel:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>SampleChannelName</members>
<name>LightningMessageChannel</name>
</types>
<version>57.0</version>
</Package>