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.

Enable New Order Save Behavior 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 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

You can install packages that support the Old Order Save Behavior on subscriber orgs that have enabled the New Order Save Behavior. However, you must verify that your package works with the new order save behavior.

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 choose to enable the release update in your Dev Hub org. We recommend supporting both the new and old order save behavior.

Test Unmanaged and First-Generation Managed Packages

  • 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.
  • 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.

  • 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.
  • 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

  • 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.
  • 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 1. 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}