Another Example of Compensating Sales Orders That Change
Set up a compensation pattern that allows time to reschedule an orchestration process when a customer requests to change the ship date.
Here's the rule you will create.
-
If the requested ship date is less than or equal to the current date plus three days, then cancel and redo the Ship Product step.
Here's where you create the rule.

Here's the code that the rule uses.
If
DooSeededOrchestrationRules.DOOFLine.requestShipDate same or less than CurrentDate.date.timeInMillis+3*24*60*60*1000
Then
assert new DooSeededOrchestrationRules.Result (resultObj."CANCEL_CREATE")
where
Code |
Description |
---|---|
|
Dictionary you use to store objects and their values. DOO means distributed order orchestration, which is term that Order Management used for order orchestration in earlier updates. |
|
Object in DooSeededOrchestrationRules. It contains fulfillment line attributes and their values. |
|
Fulfillment line attribute in DOOFLine. |
|
Property of the toLocateString function. This function references the requestShipDate attribute. |
|
Equation that specifies to use the date that happens three days after the current date. |
|
Object in DooSeededOrchestrationRules that you use to store the result of the If statement. |
resultObj |
Property of the Result object. It stores CANCEL_CREATE, which is the value that this rule uses to end the condition. |
Summary of the Steps
-
Create If statement.
-
Create Then statement.
This topic uses example values. You might need different values, depending on your business requirements.
Create If Statement
You will create a statement.
-
If the requested ship date is less than or equal to the current date plus three days
Do it.
-
In the Setup and Maintenance work area, go to the task.
-
Offering: Order Management
-
Functional Area: Orders
-
Task: Manage Orchestration Process Definitions
-
-
On the Manage Orchestration Process Definitions page, locate the CallCustomerWhenLargeInvoice orchestration process, then click Actions > Edit.
Learn how to create CallCustomerWhenLargeInvoice. For details, see Add Branches to Orchestration Processes.
-
On the Edit Orchestration Process Definitions page, in the Process Details area, in the Step Definition list, click Change Management.
-
In the Ship Item row, in the Compensation Pattern column, click Click for Rule.
-
In the Compensation Pattern dialog, click Add Rule > Expand, then set the value.
Attribute
Value
Name
Rule to Compensate When Ship Date Changes
-
In the If area, click Left Value, expand DOOSeededOrchestrationRules > DOOFline > requestShipDate, then click time > OK.
-
In the Is list, click Is > Same or Less Than.
-
Click Right Value.
-
In the Condition Browser, expand CurrentDate > Date > Time, then click timeInMillis.
Don't click OK.
-
Near the top of the Condition Browser, in the window, after
CurrentDate.date.timeInMillis
, add+3*24*60*60*1000
.Make sure the window now contains this value:
CurrentDate.date.timeInMillis+3*24*60*60*1000
The time function for most business rules work in milliseconds, so you must convert time to milliseconds. The calculation 3*24*60*60*1000 calculates the total number of milliseconds that three days contains, where.
-
3 is the number of days.
-
24 is the number of hours in one day.
-
60 is the number of minutes in one hour.
-
60 is the number of seconds in one minute.
-
1000 is the number of milliseconds in one second.
-
-
Click OK.
Create Then Statement
Create the statement that cancels, then restarts the Ship Product step so Order Management can reschedule the shipment.
-
In the Then area, click Add Action > Assert New.
-
Click Select a Target, then click DooSeededOrchestrationRules.Result.
-
Click Edit Properties.
-
In the Properties dialog, in the ResultObj row, enter the value.
Attribute
Value
Value
"CANCEL_CREATE"
You must include the double quotation marks (").
-
Click OK.
-
Click Validate, make sure the Validation Log that displays doesn't contain any errors, then click Save.
-
On the Edit Orchestration Process Definition page, click Save.