How to migrate dashboard folder by Salesforce Migration Tool?

Today I have been struggling trying to migrate reports and dashboards from developer organization to production. Looks like we can’t deploy dashboard without a folder. While for reports there exist standard ‘Unfilled Public’ folder, for Dashboard there is no predefined public folder. When I tried to deploy the dashboard I kept receiving error

Public_Dashboards/Jobs_Executed_and_Booked_For_This_Week Dashboard 0 0 Cannot find folder:Public_Dashboards

even when I tried to add folder to package.xml like this

<types>
    <members>Public_Dashboards</members>
    <name>Folder</name>
</types>

I still kept receiving the same error with additional messages like

Public_Dashboards/Jobs_Executed_and_Booked_For_This_Week Dashboard 0 0 Cannot find folder:Public_Dashboards 0 0 Unknown type name ‘Folder’ specified in package.xml

When I tried to specify DashboardFolder type in package.xml

<types>
    <members>Public_Dashboards</members>
    <name>DashboardFolder</name>
</types>

I still had the same error with a different message

0 0 Unknown type name ‘DashboardFolder’ specified in package.xml Public_Dashboards/Jobs_Executed_and_Booked_For_This_Week Dashboard 0 0 Cannot find folder:Public_Dashboards

Finally I have found today an answer in docs here: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_folder.htm

First of all, to migrate dashboards and folder you have to create public dashboard, then you can retrieve or deploy in the same way.

The documentation gives example for Document folder

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>basic</fullName>
    <types>
        <members>sampleFolder</members>
        <members>sampleFolder/TestDocument.txt</members>
        <name>Document</name>
    </types>
    <version>37.0</version>
</Package>

but this works in the same way for Dashboard folder

<types>
    <members>Public_Dashboards</members>
    <members>Public_Dashboards/Jobs_Executed_and_Booked_For_This_Week</members>
    <name>Dashboard</name>
</types>
Advertisements
This entry was posted in Ant, Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s