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
Konst MaxxKonst Maxx 

How to fetch all metadata types

Hi,

 

I have a task to retrieve all metadata from SF account.

So I should use Metadata API.

 

As I understood I need to implemet this algorithm:

1. call describeMetadata() to get all types for the given account

2. for each type I have to call listMetadata() to get properties for each type recieved in first step.

3. from the data of the step 2 I can build parameters for retrieve() method for unpackaged types.

 

So my questions are:

1. Is it correct approach in general?

2. how to get installed packages to initialize RetrieveRequest.packageNames property?

3. how should I decide if it is allowed to use "*" for PackageTypeMembers.members property?

 

Best regards,

Konstantin

Konst MaxxKonst Maxx

I've tried to use Force.com IDE and it builds package.xml for my developer SF account.

And for just registered "empty" account it returns 44 <types> elements

 

But describeMetadata() returns only 42 elements. So why we have this difference?

 

It looks like Force.com IDE uses API calls to SF to build package.xml file, so it is not something hardcoded. 

 

Here is link to my package.xml built by Force.com IDE

_Prasu__Prasu_
Force.com IDE itself must be building the Package.xml after retrieving the names of metadata in that particular org.
Konst MaxxKonst Maxx

I understand this, but Force.com IDE builds this file, as I see, dynamically.

 

So my task is to create an application that can do the same.