Another way to phrase this question: How to query against a SubscriberPackageVersionId to discover if it is the latest version of said package

I've created a Powershell script that prompts me for 2 aliases (orgs that I have previously authorized), let's call them 'source' and 'target' orgs.

It then proceeds to execute a CLI command for each alias provided: sfdx force:package:installed:list -u <<alias>>

It then does a diff between the two lists of installed packages and proceeds to install any missing packages on the 'target'

enter image description here

Now, because the default list output from the above command is in no particular order (re: dependencies) I sometimes have to execute the script a 2nd time before everything is leveled up

I noticed if I step through the list output, and use the SubscriberPackageVersionId (04t..) to look up dependencies..

sfdx force:data:soql:query --query "SELECT Dependencies FROM SubscriberPackageVersion WHERE Id='$pkgAlias'"

...I would expect any reported dependencies to be discoverable somewhere in my initial query that I explained above. However, I'm finding that is not always the case.

I have seen this simple script from Salesforce that just issues installation commands directly against the reported dependencies.. but I am assuming this may be installation overkill... since my script will then proceed to install a newer version of the dependency that it wasn't smart enough to put in the right order.

To reiterate: I think the mis-match may be that that Package A may be reporting a dependency on an older version of Package B thus I don't have the clues I need within my initial query to properly order my set of SubscriberPackageVersion numbers.

Anybody have any bright ideas?


You must log in to answer this question.

Browse other questions tagged .