Newer Version Available

This content describes an older version of this product. View Latest

Retrieve Source from an Existing Managed Package

If you’re a partner or ISV who already has a managed package in a packaging org, you’re in the right place. You can retrieve that package, unzip it to your local project, and then convert it to source format, all from the CLI.

Before you begin, create a Salesforce DX project.

  1. Retrieve the metadata from the source org.
    1sfdx force:mdapi:retrieve -s -r ./mdapipkg -u <username> -p <package name>
    The username can be a username or alias for the source org (such as a packaging org) from which you’re pulling metadata. Indicate the directory where you’d like to store the retrieved package metadata using the -r parameter. If this directory doesn’t exist, the CLI creates it. The -s parameter indicates that you’re retrieving a single package. If your package name contains a space, enclose the name in double quotes.
    1-p "Test Package"
  2. Check the status of the retrieve.
    When you run force:mdapi:retrieve, the job ID, target username, and retrieve directory are stored, so you don’t have to specify these required parameters to check the status. These stored values are overwritten when you run the force:mdapi:retrieve again.
    1sfdx force:mdapi:retrieve:report
    If you want to check the status of a different retrieve operation, specify the retrieve directory and job ID on the command line, which overrides any stored values.
  3. Unzip the zip file.
  4. (Optional) Delete the zip file.

After you finish, convert the metadata to source format.