From b716b12fd5818b5b8017915a9dd7245182a00ac5 Mon Sep 17 00:00:00 2001 From: mbianco-stripe <45374579+mbianco-stripe@users.noreply.github.com> Date: Thu, 29 Sep 2022 09:09:28 -0700 Subject: [PATCH] Possible fix for cpq/sbqq trigger soql error (#814) --- README.md | 14 ++++++++++++++ sfdx/bin/delete_test_record_data.apex | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 3510d4e41a..903e55edba 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,20 @@ In order for the ruby service to update Stripe ID fields, it needs to have the r In the org, go to setup>permission sets> stripe connector integration user> manage assignments>add assignments and check your user in the org > then click assign. +## Clearing Our Test Data + +Here's how to manually clear our test data. This may be fixed with `SBQQ.TriggerControl.disable()` in the delete script, can remove this later if this is the case! + +```shell +sfdx force:org:open -u platform-integrations-bots+cpqqapackage@stripe.com -p "/lightning/setup/ImportedPackage/home" > /dev/null +sfdx force:org:open -u mbianco+standardcpq@stripe.com -p "/lightning/setup/ImportedPackage/home" > /dev/null + +# disable apex triggers + +sfdx/bin/sfdx-wipe-account platform-integrations-bots+cpqqapackage@stripe.com +sfdx/bin/sfdx-wipe-account mbianco+standardcpq@stripe.com +``` + ## Creating a stratch org - Specify your dev hub via `sfdx force:config:set --defaultdevusername`. This can be any salesforce dev org. diff --git a/sfdx/bin/delete_test_record_data.apex b/sfdx/bin/delete_test_record_data.apex index fe760e868b..ae519c4f16 100644 --- a/sfdx/bin/delete_test_record_data.apex +++ b/sfdx/bin/delete_test_record_data.apex @@ -234,6 +234,9 @@ public static void deleteCPQRecordJobs() { } } +// https://developer.salesforce.com/docs/atlas.en-us.cpq_dev_api.meta/cpq_dev_api/cpq_api_disable_apex_triggers.htm +SBQQ.TriggerControl.disable(); + deleteCPQRecordJobs(); deactivateOrderLines(); deactivateOrders(); @@ -268,5 +271,7 @@ for (String objectApiName : listOfObjectRecordsToDelete) { recordsDeleted += deleteData(objectApiName); } +SBQQ.TriggerControl.enable(); + // to notify upstream caller to check if 0 were deleted System.debug('RECORDS DELETED: ' + recordsDeleted);