Start a conversation

Calculate Totals Skips or Fails Due to Deleted Lookup Field References

Problem

When attempting to perform "Calculate Totals" on a basket, the operation either:
- Completes but skips pricing/calculation (no visible error, but totals are not updated)
- Fails silently without any error message displayed in the UI

This typically occurs after making changes to configuration attributes or during MACD operations.

Root Cause

One or more lookup attributes in the basket's product configurations reference Salesforce records that have been deleted. Common examples include:
- Contact lookups (e.g., "Primary Delivery PIC", "Installation Contact")
- Account lookups
- Custom object lookups

When Calculate Totals runs, it attempts to validate all attribute values, including lookup references. If a lookup field points to a deleted record, the validation fails and the calculation process is aborted. However, this failure may not always surface as a visible error message in the UI, causing the operation to appear to "skip" or complete without actually calculating totals.

Resolution Steps

  1. Identify Lookup Attributes in the Basket:
  2. Open the basket in the Solution Console
  3. Review all product configurations and note which attributes are lookup fields
  4. Pay special attention to required lookup fields or those marked as impacting pricing

  5. Verify Lookup Record Existence:

  6. For each lookup attribute, note the selected record ID
  7. Navigate to the referenced record in Salesforce (Contact, Account, etc.)
  8. Check if the record exists and is active (not deleted or archived)

  9. Replace Deleted Lookup References:

  10. For any lookup field referencing a deleted record:
    • Click on the lookup field in the Solution Console
    • Select a different, valid record from the lookup dialog
    • Save the change
  11. If the lookup field is not editable in the UI, use the Solution Management API to update the attribute value

  12. Retry Calculate Totals:

  13. After updating all invalid lookup references, click "Calculate Totals" again
  14. The operation should now complete successfully and update pricing/totals

  15. Verify Calculation Results:

  16. Check that pricing has been updated
  17. Verify that all calculated fields (totals, taxes, discounts) reflect the expected values

Alternative Resolution Using Solution Management API

If the lookup field is not editable in the UI (e.g., during MACD operations where certain fields are locked), use the browser console:

let solution = await CS.SM.getActiveSolution();
await solution.updateConfigurationAttribute(
  "<CONFIGURATION_GUID>",
  [{
    name: "<ATTRIBUTE_NAME>",
    value: "<NEW_CONTACT_ID>",
    displayValue: "<NEW_CONTACT_NAME>"
  }]
);

After updating, perform Calculate Totals again.

Prevention

To prevent this issue:

  • Avoid deleting Contact, Account, or other records that are referenced in active baskets or subscriptions
  • Before deleting records, run SOQL queries to check for references in configuration attributes
  • Implement validation rules or triggers to prevent deletion of records with active basket references
  • When performing data cleanup, update or clear lookup references before deleting the target records

Important Notes

  • This issue can occur with any lookup attribute type, not just Contacts
  • The error may not always be visible in the UI, making diagnosis difficult without checking the underlying data
  • If multiple lookup fields reference deleted records, all must be corrected before Calculate Totals will succeed
  • This is particularly common in MACD baskets where original subscription data references contacts or accounts that have since been removed
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments