Disable CPQ Triggers in Apex

You can manually disable Salesforce CPQ and Salesforce Billing application logic when you update records. This process is helpful when you’re updating your own custom field. It’s also helpful when you update a record several times in one transaction and want triggers to run only on the last iteration.

Required Editions
Available in: Salesforce CPQ Summer ’16 and later

To ensure that operational issues don’t affect your org when triggers are disabled, test thoroughly. Use the global Apex API TriggerControl—the same mechanism that Salesforce CPQ uses internally—to manually disable triggers for the CPQ and Billing and the Service Cloud for CPQ packages.

TriggerControl disables only triggers in CPQ and Billing and in the Service Cloud for CPQ package. Other triggers or Salesforce logic, or your own triggers, validations, workflow rules, or processes, are unaffected.

Note

Methods 

global static void disable();

Disables built-in CPQ triggers within the current transaction.

global static void enable();

Enables built-in CPQ triggers if they had previously been disabled.

global static Boolean isEnabled()

Returns true if CPQ triggers are currently enabled. Otherwise, returns false.

Example 

1SBQQ.TriggerControl.disable();
2try {
3	// Do something simple and interesting without
4	// running triggers.
5	quote.MyStatus__c = ‘Red’;
6	update quote;
7} finally {
8SBQQ.TriggerControl.enable();
9}

Example 

1if (SBQQ.TriggerControl.isEnabled()) {
2	// Only run our logic if CPQ trigger logic is also enabled.
3	myRelatedObject.Quote__c = quote.Id;
4	insert myRelatedObject;
5}