3

An org I am working on, has a large technical debt. As I am reviewing the org, one area where I am looking at is the Installed Packages. I would like to know the following -

  • Count of installed packages
  • Usage i.e. heavily or sparsely used
  • total number of objects (and fields) associated with installed packages.

The query below gives me some insight, however I would like to know more details. That way I can analyze the data.

Select DurableId, Id, isSalesforce, MajorVersion,MinorVersion,Name, NameSpacePrefix From Publisher

I would like to know what tools or approaches other have used.

Thanks.

1 Answer 1

3

Count of installed packages

The gold standard today is Salesforce DX:

sfdx force:package:installed:list

But you could also write a Tooling API query:

SELECT Id FROM InstalledSubscriberPackage

Usage i.e. heavily or sparsely used

No direct way to get at this, as far as I can tell. You can export the package metadata (e.g. force:source:retrieve) and parse the output, and then use /services/data/v52.0/limits/recordCount?sObjects=Object1,Object2,etc to get the storage usage for those objects. Cumbersome, but definitely possible with a few API calls and some relatively simple scripts. You could theoretically even write this in pure Apex.

Also, to see how many fields are populated (e.g. non-null values), you might consider taking a Field Trip. This free package tallies up data usage in all fields/objects you select, and you can then export/report on this information. This helps identify custom fields on standard objects that you otherwise could not easily distinguish from using the above Record Count API call.

total number of objects (and fields) associated with installed packages.

Both queries below require the Tooling API (not the normal SOAP/REST API).

For fields:

SELECT COUNT() FROM CustomField WHERE NamespacePrefix='xyz'

For objects:

SELECT COUNT() FROM CustomObject WHERE NamespacePrefix='xyz'

Working from the above Salesforce DX, though, you can also retrieve the package contents, the use a terminal command to count the number of fields/objects that are used.


Basically, there's ways to get at all of this information.

You must log in to answer this question.

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