4

I'm upgrading our build system to use sfdx, and I'm trying to automate all packaging operations for our managed package.

Once a new package version has been created via sfdx, I would like to retrieve the package installation URL so that I can document it somewhere. I tried using sfdx force:package1:version:display, but I was surprised to see that it only returns things I already know and supplied at build time (package name, version and ID). There is no sign of the package install URL.

Is there a way to programmatically retrieve the install URL from a package that I just created with sfdx?

Edit: apparently the install URL can be created like this:

https://login.salesforce.com/packaging/installPackage.apexp?p0=<package version ID>

Would this work?

Edit: I'm using 1st generation packaging (1GP). I'm not planning to use 2GP.

4 Answers 4

12

You can add the --verbose flag to sfdx force:package:version:list and it will give you the Installation URLs

sfdx force:package:version:list --verbose
1
  • How did this have zero votes before today?? This is exactly the programmatic (and hindsight) way to retrieve these that I was looking for. Thank you Samir! 🙏 Commented May 18, 2020 at 22:06
5

This is the solution I used in the end. I build the install URL by concatenating a well-known string with the package ID, as follows:

https://login.salesforce.com/packaging/installPackage.apexp?p0=<package version ID>

This is working well so far for us, although it feels like a workaround

1

package:version:create:report

Retrieves details about a package version creation request in the Dev Hub org.

sfdx force:package:version:create:list -v DevHub1

sfdx force:package:version:create:report -i 08c2v000000KzJsAAK -v DevHub1

*=== Package Version Create Request NAME VALUE ───────────────────────────── ───────────────────────────────────────────────────────────────────────────────── ID 08c2v000000KzJsAAK Status Success Package Id 0Ho2v000000bleCCAQ Package Version Id 05i2v000000TNQ5AAO Subscriber Package Version Id 04t2v************G Tag Branch Created Date 2019-12-05 18:43 Installation URL https://login.salesforce.com/packaging/installPackage.apexp?p0=04t2v************G*

3
  • 1
    The asker is using 1GP, not 2GP.
    – David Reed
    Commented Dec 9, 2019 at 17:01
  • Yes, sorry, I'm using 1GP
    – mkorman
    Commented Dec 10, 2019 at 10:30
  • This actually works for 2gp. Should be the correct answer
    – Soji
    Commented Jan 19, 2023 at 14:00
1

You can use this command

sfdx force:package:installed:list

Once you've got your 1GP package Id, you can use DX to install the package to your org, eg:

sfdx force:package:install -p 04tf2000002Fg1SAAS
1
  • Thanks for the tip. This is not exactly what I'm looking for. I want an install URL so that I can share that URL with other colleagues. They, in turn, can install that package on our customers' orgs without having to run sfdx, just by using the URL. Thanks
    – mkorman
    Commented Dec 11, 2019 at 11:42

You must log in to answer this question.

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