Newer Version Available

This content describes an older version of this product. View Latest

Test and Respond to the New Order Save Behavior

If you created any type of package that includes the Order object, the installed package sometimes doesn’t work, and package upgrades or new package installations are blocked. Here’s why. The Order Save Behavior Release Update addresses an issue where Salesforce didn't correctly evaluate custom application logic on records associated with the Order object.

To ensure the expected behavior, you must test the Enable New Order Save Behavior release update. Starting in Winter ’21, if a subscriber org relies on a different order save behavior than their installed packages, the installed packages sometimes don’t work, and package upgrades or new package installations are blocked.

After the Enable New Order Save Behavior release update is enabled, Salesforce evaluates and runs these customizations whenever an update to an order item record changes the parent order record.

  • Order and order item validation rules
  • Order and order item Apex triggers and classes
  • Order and order item workflow rules
  • Order and order item flows and processes

The New Order Save Behavior release update affects all package types: unlocked, unmanaged, first-generation managed package (1GP), and second-generation managed package (2GP).

Note

After you verify that your package works with the new order save behavior and that all your packages associated with your Dev Hub org work with the new order save behavior, you can either enable the release update in your Dev Hub org or wait for it to be auto-enabled in Summer ’22. We recommend supporting both the new and old order save behavior during the Release Update window.

The scenarios in the table take effect in Winter ’21 and continue through the release update window in Summer ’22.

Table 1. Success and Failure Scenarios for Packages and Order Save Behavior
Package Uses Subscriber Org Has Enabled New Order Save Behavior Subscriber Org Has Enabled Old Order Save Behavior
New Order Save Behavior SUCCEED

Package upgrades and installations of major and minor package versions succeed. All package types succeed in this condition.

FAIL

Winter ’21
Patch upgrades for 1GP packages fail. If you enabled new order save behavior, create minor versions instead of patch versions of packages.
Summer ’21 and later
Patch upgrades fail for 1GP packages that contain Salesforce Flow. If you enabled new order save behavior for packages with Salesforce Flow, create minor versions instead of patch versions of packages. All other patch upgrades for 1GP packages are successful.
FAIL

If the subscriber org and the package are specifying different order save behaviors, package upgrades and installations are blocked.

All package types fail in this condition.

Old Order Save Behavior FAIL

If the subscriber org and the package are specifying different order save behaviors, package upgrades and installations are blocked.

All package types fail in this condition.

SUCCEED

New package installations and major, minor, and patch upgrades succeed.

All package types succeed in this condition.

Both New and Old Order Save Behavior

SUCCEED

New package installations of major and minor package version upgrades succeed.

SUCCEED

New package installations of major and minor package version upgrades succeed.

Test Unmanaged and First-Generation Managed Packages

  1. From Setup, in the Quick Find box, enter Release Updates, and then select Release Updates. Locate the Enable New Order Save Behavior tile, and select Enable Test Run.
  2. Test the impact of the new behavior when an order or order item is edited. Review any custom application logic such as validation rules, Apex triggers and classes, workflow rules, flows, and processes.

    We recommend supporting both the new and old order save behavior during the Release Update window.

  3. To indicate that your package is compatible with both new and old order save conditions, from Setup, in the Quick Find box, enter Package. Select the package that you tested and select Upload.
  4. Locate the Package Requirements section and disable New Order Save Behavior.

    When this setting is disabled and the release update is enabled, subscriber orgs using either the new or old order save behavior can install your package.

Test Unlocked and Second-Generation Managed Packages

  1. After creating a scratch org, enable the Release Update in it. From Setup, in the Quick Find box, enter Release Updates, and then select Release Updates. Locate the Enable New Order Save Behavior tile, and select Enable Test Run.
  2. Test the impact of the new behavior when an order or order item is edited. Review any custom application logic such as validation rules, Apex triggers and classes, workflow rules, flows, and processes.

When you’re ready to create a package version, specify the order save behavior in the definition file.

Table 2. Order Save Behavior Options
To Specify Set Features in Scratch Org Definition File To
Old Order Save Behavior
1{
2   "features": [],
3  "settings": {
4    "orderSettings": {
5      "enableOrders": true
6    }
7  }
8}
New Order Save Behavior
1{
2  "features": ["OrderSaveLogicEnabled"],
3  "settings": {
4    "orderSettings": {
5      "enableOrders": true
6    }
7  }
8}
New and Old Order Save Behavior
1{
2   "features": ["OrderSaveBehaviorBoth"],
3  "settings": {
4    "orderSettings": {
5      "enableOrders": true
6    }
7  }
8}