Limit Assets Collected by the Digital Commerce API

Communication, Media, and Energy cloud leverages the Salesforce asset object to indicate what products and services have been bought by the customer, according to the customer account. Other packages, code, or businesses processes, including those of a third party, can also leverage the Salesforce asset object and populate records in the object.

When too many asset records are created on the object outside of the CME-managed package, Digital Commerce reaches a governor limit and throws a SOQL error, such as Too many query rows: 50001, when trying to execute the Asset to Basket API.

To avoid reaching governor limits and getting the SOQL error, you can limit the assets collected by the Digital Commerce API.

  1. Create an Apex class named TransactionContextUtils.

  2. Create an Apex class named CustomAssetsContextParser.

  3. Add and activate a new interface implementation for AssetsContextInterface named CustomAssetsContextParser.

    1. From the App Launcher, click Interface Implemtations.

    2. Click New.

    3. In the New Interface Implementation dialog, for Interface Name, enter AssetsContextInterface.

    4. Click Save.

    5. Click the Related tab.

    6. Beside Interface Implementation Detail, click New.

    7. In the New Interface Implementation Detail dialog:

      • For Available Implementation, enter CustomAssetsContextParser.

      • For Interface Name, enter CustomAssetsContextParser.

      • Click the Active check box to activate the interface implementation.

    8. Click Save.

      Assets Context Interface