Start a conversation

Configuration Updates Fail During Calculate Totals Due to Basket Stage Lock

Problem

When attempting to perform Calculate Totals in the Solution Console, configuration updates fail with the following error:

SolutionError: Cannot update configuration when basket/solution is locked.

The error typically occurs at the point where custom code attempts to update configuration attributes programmatically:

solution.updateConfigurationAttribute(keys[i], updateMap[keys[i]], true);

This prevents Calculate Totals from completing successfully and blocks any configuration changes that depend on calculation logic.

Root Cause

The basket is in a stage other than Solution Creation, which locks the basket for configuration updates.

CloudSense enforces basket locking based on the current stage to maintain data integrity and prevent unintended modifications during specific workflow phases. When a basket is in stages such as:
- Commercial Determined
- Commercial Approval
- Technical Approval
- Order Generation
- Or any other non-editable stage

The system automatically locks the basket to prevent configuration changes, including programmatic updates via solution.updateConfigurationAttribute().

Resolution Steps

Step 1: Check Current Basket Stage

  1. Open the basket in the Solution Console
  2. Check the basket stage indicator at the top of the page
  3. Note the current stage (e.g., Commercial Determined, Solution Creation, etc.)

Step 2: Change Basket Stage to Solution Creation

  1. In the Solution Console, locate the Stage dropdown or Stage selector
  2. Select "Solution Creation" from the available stages
  3. Save the basket to apply the stage change

Alternatively, if using custom code or APIs:

// Change basket stage to Solution Creation
await CS.SM.getActiveSolution().then(solution => {
  solution.setStage('Solution Creation');
  return solution.save();
});

Step 3: Retry Calculate Totals

  1. Click the "Calculate Totals" button in the Solution Console
  2. Verify that the operation completes without the locking error
  3. Check that all configuration updates have been applied successfully

Step 4: Return to Appropriate Stage (If Needed)

After Calculate Totals completes successfully:

  1. Change the basket stage back to the appropriate workflow stage (e.g., Commercial Determined)
  2. Save the basket to lock it again for the next phase

Prevention

To avoid this issue in the future:

  • Ensure Calculate Totals logic runs only in Solution Creation stage: If your custom code performs configuration updates during Calculate Totals, add a stage check before attempting updates:
await CS.SM.getActiveSolution().then(solution => {
  if (solution.stage !== 'Solution Creation') {
    console.warn('Basket must be in Solution Creation stage for configuration updates');
    return;
  }
  // Proceed with configuration updates
  solution.updateConfigurationAttribute(key, value, true);
});
  • Document stage requirements: If your implementation requires specific stages for certain operations, document these requirements in your custom code comments or implementation guides

  • Use stage-appropriate APIs: For read-only operations (e.g., reading attribute values, calculating totals without updates), ensure your code does not attempt write operations that would trigger the lock error

Important Notes

  • Basket locking is a platform feature designed to maintain data integrity during workflow transitions
  • The lock applies to all configuration update operations, including programmatic updates via JavaScript APIs
  • Changing the basket stage may trigger other business rules or validations depending on your implementation
  • If your custom code requires configuration updates during Calculate Totals, ensure the basket is in Solution Creation stage before invoking the calculation
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments