4

I'm trying to deploy a list view for a custom metadata type using the Force.com Migration Tool, but I am unable to locate the ListView to include in my package.xml retrieve. I have deployed many ListViews for custom objects, but ListViews for custom metadata types aren't showing up in the "metadata explorer" interface I use (Workbench).

How do I reference the custom metadata type's ListView in my package.xml?

What I've tried:

<types>
    <members>Conference_RSVP_Config__mdt.All_Conferences</members>
    <name>ListView</name>
</types>

The result:

Entity of type 'ListView' named 'Conference_RSVP_Config__mdt.All_Conferences' cannot
 be found
2
  • whats your API version ? Commented May 14, 2018 at 19:48
  • 40.0 for my package.xml. 41.0 for the Workbench, where I can't find the ListView Commented May 14, 2018 at 19:54

2 Answers 2

8

List view fetching for custom metadata types are bit tricky.

If you retrieve a List View on a Custom Setting/Custom Metdata along with the Custom Setting/Metadata object when using Metadata API in a single transaction, the List View information is not retrieved.

You have to retrieve both separately.

Suppose:

MetaData Object Name: MyObject__mdt

ListView Unique Name: My_View

Then your listview package.xml will be

<?xml version="1.0" encoding="UTF-8"?> 
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> 
<types> 
<members>MyObject__mdt.My_View</members> 
<name>ListView</name> 
</types> 
<version>39.0</version> 
</Package> 

It will retrieve Object file for you containing the Listview

Known Issue Link : https://success.salesforce.com/issues_view?id=a1p3A0000018BCTQA2

3
  • 1
    Thanks for this, @Pranay Jaiswal. The Known Issue you linked to solves my problem. However, would you please update your response to emphasize the key here, which is that if you retrieve a List View on a Custom MDT along with the Custom MDT object when using Metadata API in a single transaction, the List View information is not retrieved. I had to remove the retrieve of the CustomObject iin order to get the list views to show up, until the Summer '18 release which apparently resolves the issue. Commented May 14, 2018 at 20:13
  • 1
    That was my first line , somehow got ommited :/ Edited finally. Commented May 14, 2018 at 20:16
  • You can still retrieve CustomObjects by using the build.xml and specifying a second package file and 2 sf:retrieve commands inside one target node. <sf:retrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="test" unpackaged="test/package0.xml"/> <sf:retrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="test" unpackaged="test/package.xml"/> - Commented Jul 24, 2019 at 7:31
3

(Winter 23)

My testing shows that

<?xml version="1.0" encoding="UTF-8"?>
 <Package xmlns="http://soap.sforce.com/2006/04/metadata">
   <types>
    <name>CustomObject</name>
    <members>MyCustomMDT__mdt</members>
   </types>
   <version>56.0</version>
</Package>

will:

  • Retrieve listviews declared as Visible to All users
  • Will not retrieve listviews as Visible only to me. And, MDAPI doc says this is WAD List views with the Visible only to me Restrict Visibility option aren’t accessible in Metadata API. Each of these list views is associated with a particular user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .