function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hank MishkoffHank Mishkoff 

How do I use the WorkBench to retrieve metadata?

I’m trying to figure out how to retrieve Field Audit Trail metadata using the WorkBench, and I’m stumped. I used the WorkBench to deploy a zip file named package-Dev.zip, which contained the following files:

1) A file named Account.object: 
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
   <historyRetentionPolicy>
       <archiveAfterMonths>14</archiveAfterMonths>
       <archiveRetentionYears>10</archiveRetentionYears>
       <description>Account object field history retention policy -- Dev</description>
       <gracePeriodDays>0</gracePeriodDays>
   </historyRetentionPolicy>
   <fields>
       <fullName>BillingAddress</fullName>
       <fullName>City_Mailing_Address_Group__c</fullName>
   </fields>
</CustomObject>
 
2) A file named package.xml: 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
    </types>
    <version>32.0</version>
</Package>
 
Now I want to use the WorkBench to retrieve the metadata (history retention policy and fields) that I deployed for the account object via package-Dev.zip. What ‘s the XML code that I need to use to retrieve that metadata? I'm not an XML or API programmer, and all of the examples I've found seem to assume that I know more than I do, so I'm lost.
 
Thanks for your help!
 
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

You can go to Tab --> Migration --> Retrieve --> Provide the packge.xml (Mention the component you want to reterive)

Please go through (http://myfirstcloudforce.blogspot.com/2014/01/retrieve-data-using-workbench-or-take.html)

Hope this helps

--
Thanks,
Swayam
Hank MishkoffHank Mishkoff
Swayam: I followed your helpful instructions (and those at the URL you referenced), but I'm not having any luck.

Here's the package.xml file I submitted:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
	<types>
		<members>*</members>
		<name>HistoryRetentionPolicy</name>
	</types>
	<version>32.0</version>
</Package>
But when I go through the "retrieve" process, I get back the same file I sent. I assume the problem is with my "name" element, because I'm getting a message that says "Problem: Entity type: 'HistoryRetentionPolicy' is unknown." I've tried various other values, but nothing seems to work. Any ideas? Thanks so much for your help!

 
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,


HistoryRetentionPolicy is a field or object ? 
 
Hank MishkoffHank Mishkoff
I thikn it's an object: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_historyretentionpolicy.htm
 
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

You need to use this code, 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>HistoryRetentionPolicy</members>
        <name>CustomObject</name>
    </types>
    <version>36.0</version>
</Package>
Hope this help

--
Thanks,
Swayam
 
Hank MishkoffHank Mishkoff
Same outcome (it still sent the same file back to me). Error message this time: "Entity of type 'CustomObject' named 'HistoryRetentionPolicy' cannot be found."

Maybe it's not possible to retrieve the History Retention Policy metadata via the Workbench?
Swayam@SalesforceGuySwayam@SalesforceGuy
Yes It seems to be its always link to the object

Please check (http://resources.docs.salesforce.com/200/5/en-us/sfdc/pdf/field_history_retention.pdf)

--
Thanks,
Swayam
Hank MishkoffHank Mishkoff
Yes, I used that guide to figure out how to set the retention policy, and I used the Deploy feature of the Workbench to set it. I feel kinda blind not being able to retrieve the retention policy so I can verify that I set it correctly, but I guess I can't do that via the Workbench. :(

Anyway, thanks so much, Swayam, I greatly apprecaite all of your help.
Francisco LozanoFrancisco Lozano
Did you ever figure it out @Hank Mishkoff? I'm trying to do the same with no success.
Kashif Ahmed 17Kashif Ahmed 17
@hank mishkoff Include the custom objects API name to retrieve it will work.
HistoryRetentionPolicy_c