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
Hugues RaguetHugues Raguet 

Retrieve installed packaged without Namespace prefix

Hi, I want to retrieve and deploy installed packages with the Ant migration tool.
In my Org, there are 4 installed packages : 2 have namespace prefix, 2 don't have.
The retrieve command only returns the 2 installed packages that have a namespace prefix.
Is there a way to retrieve the two others that don't have a namespace prefix ?
Ajinkya1225Ajinkya1225
Hi Hugues,

It's not possible with that method. The InstalledPackage metadata type requires a namespace and unmanaged packages don't have one.

What you can do is install the unmanaged package into an org and then do a retrieve of the package's metadata. You can use the retrieved package metadata to deploy into any other org via ant or any other deployment tool. It will create the package and add all the metadata into it the same as would be done if you install the unmanaged package through the installation url.

The way this works is the magical <fullName>PACKAGE_NAME</fullName> line in the package.xml when retrieved passing the packageNames parameter instead of a manifest to retrieve. Here's an example:

https://github.com/SalesforceFoundation/CumulusCI/blob/master/build/cumulusci.xml#L252

Please upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh
Hugues RaguetHugues Raguet
Hi Ajinkya, thx for your answer.

Do you mean that I can retrieve the package's metadata with the retrieve command of the Ant migration tool and a different package.xml ?

The package.xml I was using was:

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



Should I use this package.xml :
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        
<fullName>Salesforce Chatter Dashboards 1.0</fullName>
    </types>
    <version>37.0</version>
</Package>
Ajinkya1225Ajinkya1225
Hi Hugues,

That should work. I haven't tried it myself though. You can try using-
 
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="@{dir}" unpackaged="${manifest}"/>

Please upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh