When you are working with a large number of orders and you must create rules for different business scenarios (for example, pro-rating subscriptions, or cancelling orders due to a delay in provisioning), you can use Order Workflows to automate in-flight changes to orders based on certain criteria.

Order Management allows you to automate in-flight order changes and cancellation using Order Workflow rulesets and rules. Creating Order Workflows comprises two main tasks. First, you define a Workflow Ruleset to provide the business and trigger context, and any criteria related to the trigger. You then create a Workflow Rule and Workflow Rule Entries within that ruleset to instruct the system which action or actions to execute based on further criteria. 

You can only create one workflow rule per ruleset. Each workflow rule can contain one or more workflow rule entries.

When a workflow ruleset is triggered, the specified workflow rule executes based on the criteria that triggers one or more of its rule entries. For example, you could create a workflow rule that automatically amends the order to change the subscription date of one or more line items when the agreement is accepted.

Executing Order Workflow Rulesets

Order Workflow Rulesets trigger based on any of the following events:

  • Automatic:
    • An order is created from a quote or agreement.
    • A partial order is created from a price agreement.
    • An order is accepted.
  • Manual: Ready for Workflow is enabled and the order record is saved.
After a workflow ruleset is executed, the Ready for Workflow flag is disabled.

Perform the following tasks to set up a Workflow ruleset for automating in-flight order changes and cancellation.

To create an Order Workflow Ruleset

  1. Click All Tabs () > Order Workflow Rulesets > New (in Salesforce Lightning, go to App Launcher > Order Workflow Rulesets > New). The New Order Workflow Ruleset page is displayed.



  2. Enter the Ruleset Name.
  3. Click the Type drop-down and select API Execution.
  4. Enter a Sequence value (begins at "1"). This defines the sequence in which to execute the ruleset when an event triggers more than one ruleset. 

    To avoid errors, specify a unique sequence value for every workflow ruleset.

  5. Click the Business Context Type drop-down and select the context object (default is "Order").
  6. Depending on your requirements, click the Trigger Context Type drop-down and select the appropriate trigger:
    • Order
    • Order Fulfillment
  7. Depending on your requirements, add the appropriate Trigger Event(s) from the Available box to the Chosen box.
  8. Select the Active checkbox.
  9. Click Save. The ruleset is created.

To define criteria for the Workflow Ruleset

Perform the following task to define the triggering criteria for a workflow ruleset.

  1. From the Workflow Ruleset Detail page, click Criteria. The Order Workflow Ruleset Edit page for Criteria Edit is displayed.
  2. Click Edit. The Criteria Edit page is displayed.
  3. Click the Field drop-down and select a field on the Order object.
  4. Click the Operator drop-down and select an operator for the expression.
  5. Click the Map To drop-down and select one of the following:
    • None: Evaluate the expression based only on the Field > Operator > Value defined.
    • Function: Date fields only. Specify days or months and the offset value.
    • Order: Map the field on the Order object to the value of another standard or custom field on the Order object.
  6. Enter or select a Value for the expression. 
  7. Click the Add Row () icon to add another expression. Repeat steps 3 – 6 to define additional criteria.
  8. Click Advanced Options to add filter logic if necessary (for example: "(1 OR 2) AND 3").
  9. Click OK to save the criteria and return to the Workflow Ruleset Detail page.

To create an Order Workflow Rule

You can create only one workflow rule per ruleset. Each workflow rule can contain one or more workflow rule entries.

  1. Click New Order Workflow Rule from the Order Workflow Ruleset page. The New Order Workflow Rule page is displayed.
  2. Enter a Sequence value (begins at "1").
  3. Click the Action drop-down and select one of the following actions to be executed when the Workflow Ruleset is triggered:
    • Amend Order: Automatically amend the order. The order must be manually accepted after it is amended.
    • Amend and Accept Order: Automatically amend and accept the order. 
    • Cancel Order: Automatically cancel the order. User must manually accept the order cancellation.
    • Cancel and Accept Order: Automatically cancel and accept the order cancellation.
  4. (Optional) Enter a Description.
  5. Click the lookup icon and select the ruleset to associate with the rule (automatically filled when the rule is created from a ruleset detail page.)
  6. Click Save.

To create an Order Workflow Rule Entry

  1. Click New Order Workflow Rule Entry from the Order Workflow Rule page. The New Order Workflow Rule Entry page is displayed.
  2. Enter a Sequence value (begins at "1"). This defines the sequence in which to execute the workflow rule entries when the workflow ruleset is triggered.
  3. Click the Context Type drop-down and select Order Line Item.
  4. Click the Action drop-down and select one of the following actions to be executed when the rule entry criteria is fulfilled:
    • Amend Order Items: Amend the order line item specified by the rule entry criteria.
    • Cancel Order Items: Cancel the order line item specified by the rule entry criteria.
  5. Click Save.

To define criteria for line item workflow rule entries

Perform the following task to define the criteria that determine which Order Line Items are amended or cancelled when the workflow rule is executed.

  1. From the Order Workflow Rule Entry page, click Item Criteria. The Order Workflow Rule Entry Edit page for Criteria Edit is displayed.
  2. Click Edit. The Criteria Edit page is displayed.



  3. Click the Field drop-down and select a field on the Order Line Item object. Standard and custom fields on the Order Line Item object are available for selection.
  4. Click the Operator drop-down and select an operator for the expression.
  5. Click the Map To drop-down and select one of the following:
    • None: Evaluate the expression based only on the Field > Operator > Value defined.
    • Function: Date fields only. Specify days or months and the offset value.
    • Order Line Item: Map the field on the Order Line Item object to the value of another standard or custom field on the Order Line Item object.
  6. Enter or select a Value for the expression.
  7. Click the Add Row () icon. Repeat steps 3 – 6 to define additional criteria.
  8. Click Advanced Options to enter filter logic (for example, "(1 OR 2) AND 3").
  9. Click OK to save the Item Criteria and return to the Order Workflow Rule Entry page.

To define the input for line item workflow rule entries

Perform this task to define the action taken on one or more Order Line Items defined by the Item Criteria when the workflow rule is executed.

  1. From the Order Workflow Rule Entry page, click Item Input. The Order Workflow Rule Entry Edit page for Input Edit is displayed.
  2. Click Edit. The Input Edit page is displayed.



  3. Click the Field drop-down and select a field on the Order Line Item object.
  4. Click the Operator drop-down and select an operator for the expression.
  5. Click the Map To drop-down and select one of the following:
    • None: Evaluate the expression based only on the Field > Operator > Value defined.
    • Function: Date fields only. Specify days or months and the offset value.
    • Order Line Item: Map the field on the Order Line Item object to the value of another standard or custom field on the Order Line Item object.
  6. Enter or select a Value for the expression.
  7. Click the Add Row () icon. Repeat steps 3 – 6 to add another input.
  8. Click Advanced Options to enter filter logic (for example, "(1 OR 2) AND 3").
  9. Click OK to save the Item Input and return to the Order Workflow Rule Entry page.

Use Case: Automatic Subscription Rollover

Description: This use case describes how to create a Workflow Ruleset to handle automatic subscription rollover for in-flight order changes.

Prerequisite: In-Flight Order Changes and Cancellation must be configured in Order Management Settings. Refer to the Order Management on SFDC Administrator Guide for more information.

You are tasked with modifying an in-flight order for subscription products. The product originally sold from January 1st to December 31st at a $1200 price point for a quantity of 10. However, fulfillment order the order is complete on January 31st. You need the subscription term to roll over, meaning that the order must be automatically modified to start on February 1st and end on January 31st the next year.

To create the Order Workflow Ruleset

  1. Click All Tabs () > Order Workflow Rulesets > New (in Salesforce Lightning, go to App Launcher > Order Workflow Rulesets > New). The New Order Workflow Ruleset page is displayed.
  2. Enter "Autoroll" as the Ruleset Name.
  3. Click the Type drop-down and select API Execution.
  4. Enter "1" for the Sequence.

  5. From the the Business Context Type drop-down, select Order.
  6. Click the Trigger Context Type drop-down and select Order.
  7. Select the Active check box.
  8. Click Save. The ruleset is created.


To create the Order Workflow Rule

  1. Click New Order Workflow Rule from the Order Workflow Ruleset page. The New Order Workflow Rule page is displayed.
  2. Enter "1" for the Sequence
  3. Click the Action drop-down and select Amend and Accept Order.
  4. Enter "Auto Rollover Subscription on Fulfillment" in the Description field.
  5. Click the lookup icon and select the Autoroll ruleset you created in the first task.
  6. Click Save.


To create the Order Workflow Rule Entry and define criteria

  1. Click New Order Workflow Rule Entry from the Order Workflow Rule page. The New Order Workflow Rule Entry page is displayed.
  2. Enter "1" for the Sequence value. 
  3. Click the Context Type drop-down and select Order Line Item.
  4. Click the Action drop-down and select Amend Order Items.
  5. Click Save.
  6. From the Order Workflow Rule Entry page, click Item Criteria. The Order Workflow Rule Entry Edit page for Criteria Edit is displayed.
  7. Click Edit. The Criteria Edit page is displayed.
  8. Click the Field drop-down and select Status.
  9. Click the Operator drop-down and select equal to.
  10. Enter "Fulfilled" for the Value.
  11. Click OK to save the Item Criteria and return to the Order Workflow Rule Entry page.


To define input for the Order Workflow Rule Entry

For the input, perform the following tasks to shift the start date by a fixed number of days while keeping the end date the same.

  1. From the Order Workflow Rule Entry page, click Item Input. The Order Workflow Rule Entry Edit page for Input Edit is displayed.
  2. Click Edit. The Input Edit page is displayed.
  3. Click the Field drop-down and select Start Date.
  4. Click the Operator drop-down and select equal to.
  5. Click the Map To drop-down and select Function.
  6. Click the drop-down to the right of Map To and select Today.
  7. Click the Add Row () icon to add another line.
  8. On the new row, click the Field drop-down and select End Date.
  9. Click the Operator drop-down and select equal to.
  10. Leave the Map To value as --None-- and leave the Value field blank.
  11. Click OK.


Result

  • The "Auto Roll" Order Workflow Ruleset is created.
  • The corresponding rule and rule entry is created. Criteria and inputs are specified to ensure that when a subscription order line item is fulfilled, the start term is modified to automatically rollover the subscription term without changing the end date.