Skip to main content
All CollectionsSalto for SalesforceGuides
How to count elements in Salesforce
How to count elements in Salesforce

This article provides a detailed walkthrough for determining the number of records associated with specific types in Salesforce

Support avatar
Written by Support
Updated over 9 months ago

To calculate the usage-based pricing for Salto, Salto needs to count the number of metadata records in your org.

The easiest and most accurate way is to sign up for Salto and let Salto do the calculation. This is the recommended option. Learn how

If you want to calculate the number of records before signing up to Salto, ask someone from your Salesforce team to follow these instructions:

Count Discrepancies

Exclude managed packages that are not CPQ-related to get an accurate estimate, because Salto does not manage them by default. For CPQ-related elements - refer to the 'Counting CPQ elements' section.

It's important to note that Salto, by default, excludes additional elements, resulting in a potentially lower count of records by Salto compared to your own count. For instance, the script below counts the following records, which should be excluded when using Salto's default settings:

  1. Personal Email Templates.

  2. Product2, Pricebook2, and PricebookEntry, that are not referenced by other elements.

Counting Manually

Custom Metadata Types and Custom Objects can easily be counted manually:

Custom Metadata Type

  1. To access the Custom Metadata Types page, from Setup, enter Custom Metadata Types in the Quick Find box, then select Custom Metadata Types

  2. Count the number of custom metadata types

Custom Object

  1. Open the Object Manager

  2. Scroll down to the bottom of the table

  3. The label at the top displays the precise count of items:

Counting with the Developer Console

For the rest of the metadata types, Salto recommends counting them by using the following pre-built script in the developer console.

This script is safe! All it does is read/count how many records exist per metadata type. The script does not modify/edit/add anything to your org. All the data also stays in your org.

Developer Console

  1. Click the Setup menu and open the Developer Console:

  2. Once opened, click the Debug menu and then Open Execute Anonymous Window:

  3. Check Open Log and then click Execute:

  4. Click the Debug Only checkbox:

  5. You should now see the count of your metadata records:

Counting CPQ elements

If you want to use Salto for CPQ, you also need to count the number of CPQ elements. For this, we have an additional script, which you can run using the same steps described above: https://github.com/salto-io/salesforce-element-count/blob/main/CountCPQRecords.cls

The script will give a breakdown of how many records per CPQ object you have, and a total.

This includes Product2, Pricebook, PricebookEntry and any objects from CPQ Advanced Approvals.

Related article

Did this answer your question?