Deploying CPQ Consumption Schedules
Toby Newman avatar
Written by Toby Newman
Updated over a week ago

ANNOUNCEMENT: This article describes how to deploy CPQ with our sandbox seeding add-on. Our new Gearset for CPQ deployment solution is now our recommended product for deploying all of your CPQ configuration. See our Gearset for CPQ documentation for more information.

Looking at the above data schema, it should be relatively easy to deploy Consumption Schedules and their related components in a few simple deployments. Gearset allows you to follow lookup relationships in your data deployment plan, meaning that in theory a two-stage deployment should work:

  • Deployment 1. Deploy Product Consumption Schedule, with Consumption Schedule and Product being brought in by Gearset via the lookup mapping

  • Deployment 2. Deploy Consumption Rate, which will follow a lookup to Consumption Schedule (upsert), and thus completing the reference between the two

However - due to some nuances around triggers and fixed requirements from the CPQ package, this deployment plan won't work.

We've compiled some known errors and the correct deployment plan below.

Problems

If you attempt Deployment 1 (above), an error message will suggest you need at least one Consumption Rate first: INVALID_INPUT:Can't activate consumption schedule. Add at least one consumption rate.:--. Yet attempting to deploy a Consumption Rate on its own will also produce an error, because it cannot exist without a Consumption Schedule.

Furthermore, if Products exist in the target and reference the Consumption Schedule being deployed you're likely to hit this error: FIELD_CUSTOM_VALIDATION_EXCEPTION:Field is not writeable: Product2.HasConsumptionSchedule__c:--.

To work around this error you might try disabling the Consumption Schedule in your source org and then reattempt the deployment, but this will produce its own error: FIELD_INTEGRITY_EXCEPTION:Cannot add inactive Consumption Schedule to Product: Consumption Schedule ID:ConsumptionScheduleId --.

The deployment plan which works

You can work around these errors by using a few handy tricks, and by deploying in the correct order:

Step 1 - Disable CPQ triggers in target org. This immediately mediates a few of the pesky errors. Setup > search Installed Packages in Quick Find > hit Configure next to Salesforce CPQ > Additional Settings tab > check Triggers Disabled > Save.


Step 2 - Deactivate the Consumption Schedule(s) you plan to deploy in your source org.




Step 3 - Deploying Consumption Rate and Consumption Schedule.

  1. Run a data deployment between your source and target orgs.

  2. On the data configuration page, input the following:

    1. Choose ConsumptionRate ONLY as the primary component on the left-hand side

    2. Filter by ConsumptionScheduleId, entering the record ID for the Consumption Schedule you'd like to deploy. If you have multiple Consumption Schedules to deploy, hit + Add another value and separate by OR syntax

    3. Select ConsumptionSchedule in the reference fields list at the bottom


  3. On the next page, unselect all related components, leaving only ConsumptionSchedule checked (unless other objects are related to your build, but we'd advise deploying these prior to attempting this deployment).

    Bear in mind Consumption Rate does not have an out-of-the-box external ID field. If you're trying to update existing Consumption Rates this deployment will duplicate them, which will cause a CPQ error further down the line: -- INVALID_INPUT:Can't activate consumption schedule. Consumption Rates can't have the same processing order.:--INVALID_INPUT:Can't activate consumption schedule. A consumption rate's upper bound can't overlap the next consumption rate's lower bound.:--. Consider making an external ID field for Consumption Rate if you need to upsert, before attempting this deployment. If this is a new build, creating new Consumption Rates won't cause an issue.


  4. After the data masking page (which you should skip), disable any validation rules / triggers, and deploy data.

Step 4 - Set your Consumption Schedule(s) to Active in your source org. In Step 2 we deactivated Consumption Schedule(s) in order to deploy the Consumption Rate successfully, but we now need to reactivate to avoid an error at the next stage.

Step 5 - Deploy Product Consumption Schedule, Consumption Schedule and Product.

  1. Run a data deployment between your source and target orgs.

  2. On the data configuration page, input the following:

    1. Choose ProductConsumptionSchedule ONLY as the primary component on the left-hand side

    2. Filter by ConsumptionScheduleId, entering the record ID for the Consumption Schedule you'd like to deploy. If you have multiple Consumption Schedules to deploy, hit + Add another value and separate by OR syntax

    3. Select ConsumptionSchedule and Product2 in the reference fields list at the bottom




  3. On the next page, unselect all related components, leaving only ConsumptionSchedule and Product2 checked (unless other objects are related to your build, but we'd advise deploying these prior to attempting this deployment).

    Leave the deployment method as Upsert records for ConsumptionSchedule and Product2: we want Gearset to complete relationships between the different components, but we don't want to duplicate the records. Note: ensure you're using a upsert field which is unique across your data. If you don't use Product Codes on your Products but upsert via this field, you will accidentally create duplicate data.

  4. After the data masking page (which you should skip), disable any validation rules / triggers, and deploy data.

Tada! 🎉 You have successfully deployed Consumption Schedule and the immediate relationships.

Considerations

  • This doc addresses the objects directly relating to Consumption Schedule. In CPQ quote and order processes Consumption Schedule's config will be used to make further record types - e.g. SBQQ__OrderItemConsumptionSchedule__c and SBQQ__QuoteLineConsumptionSchedule__c. Deploying data for these objects belongs to a different data tree looking up to Consumption Schedule, and will require a similar staged-deployment approach with related components (Quote, Order Item, etc.)

  • We get it - CPQ can be tricky! We're always keen to hear any feedback you might have, and likewise we're here to help if something's not quite right. Reach us on the in-app chat.

Did this answer your question?