I need the Package Id to activate the license on the LMO, I have all the process but I can't differentiate between the different packages managed by the same lmo.
Got it. Each License in the LMA is related to a Package Version (lookup field on the License record). And a Package Version is related to a Package in LMA. Any chance you determine the difference with those related values?
A customer installs a package on his org, on that moment a record is generated on the LMO automatically and the license on that moment is a trial, I already implement a payment processor to give the customer the ability to buy the license through the app, when the payment is processed, The processor sends a request to the LMO and automatically activate the license, this process is already working, but if I have two packages on the same org, managed by the same LMO I can't differentiate onefromanother, this is because the only field I have is the Org Id.
That helps. But don't you also know which app or package was purchased. And can't you pass that name to the org where LMO is configured so you can differentiate between the two licenses for the same org id? For example, "OrgID: 000abc" bought "package=ABC".
What's the use case? I don't know any of way to do that via Apex.
I need the Package Id to activate the license on the LMO, I have all the process but I can't differentiate between the different packages managed by the same lmo.
Thanks!
Got it. Each License in the LMA is related to a Package Version (lookup field on the License record). And a Package Version is related to a Package in LMA. Any chance you determine the difference with those related values?
No :(, I'm looking for the package Id for that reason, I've not any field to differenciate the licenses.
I must be missing something. Walk me through your flow. Do you know the specific license? Or Lead? And you want to activate/update the license?
This flow is like this:
A customer installs a package on his org, on that moment a record is generated on the LMO automatically and the license on that moment is a trial, I already implement a payment processor to give the customer the ability to buy the license through the app, when the payment is processed, The processor sends a request to the LMO and automatically activate the license, this process is already working, but if I have two packages on the same org, managed by the same LMO I can't differentiate one from another, this is because the only field I have is the Org Id.
Sorry by my English.
Thanks again!
That helps. But don't you also know which app or package was purchased. And can't you pass that name to the org where LMO is configured so you can differentiate between the two licenses for the same org id? For example, "OrgID: 000abc" bought "package=ABC".
Follow the following steps
- Set up CLI. (https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm)
- Auth your org using command sfdx force:auth:web:login (https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_force_auth)
- Run the package list command and specify the user ID using -u parameter: sfdx force:package:installed:list -u <target org's user id> (https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_package.htm#cli_reference_install)
Hope this helps