Pause for Time with Flexfields

Assume you must limit the time you allow your business partners to provide quotes to 90 days.

You already set up an extensible flexfield with a context named Quote and a segment named quoteexpiration that allows the Order Entry Specialist to use the Order Management work area to specify the expiration date for the quote.

You can create a pause task that expires on the date and time that the expire quote segment specifies. This segment resides in the Quote context of an extensible flexfield.

Here are the rules that you create.

Rule

Description

Pause for 90 Days

Pause for 90 days without conditions.

Pause Until Quote Expires

Pause task that expires on the date and time that the expire quote segment specifies. This segment resides in the Quote context of an extensible flexfield. If Pause Until Quote Expires expires, then it will override Pause for 90 Days.

First Rule

Here's the first rule.

rule that Pauses for 90 Days

Note

Code

Description

Priority equals High

Make sure you run this rule before you run any other rule.

Header is a DooSeededOrchestrationRules.DOOHeader and

Declare the Header variable, then load values into Header from the DOOHeader object of the DooSeededOrchestrationRules method. DOOHeader contains order header attributes and their values.

This If statement doesn't include conditional logic because we must run the rule in all conditions.

DooSeededOrchestrationRules.SacResult SAC new DooSeededOrchestrationRules.SacResult()

Create a new instance of the SAC variable, set it to the SacResult type in the DooSeededOrchestrationRules method.

header.sacResult = SAC

Set the value of the sacResult object on the order header to the value that SAC contains.

header.sacResult.reevaluateFlag = "N"

The IF statement doesn't contain a condition that we must reevaluate.

header.sacResult.sacType = DooSeededOrchestrationRules.SacResult.SAC_TYPE_TIMER

Specify the type of pause as a timer.

header.sacResult.waitDateTime = header.GetAdjustedDate(null,90)

Get the current date, add 90 days to it, and store the result in the waitDateTime parameter of the sacResult object on the order header. The rule won't release the pause until waitDateTime happens.

GetAdjustedDate Function

Here are the parameters that you can use with the GetAdjustedDate function.

  • First parameter. A date, a date variable, or leave it empty for current date.

  • Second parameter. Number of days. Use a whole number or a fraction, such as 0.5 for 12 hours.

GetAdjustedDate adds the number of days to the first parameter, then returns the result as date and time.

To add minutes or hours, express the second parameter as a fraction.

Format

Example

Number of minutes * 1 / (24 * 60).

To add 30 minutes, use 30 * 1 / (24 * 60)

Number of hours * 1 / 24.

To add 5 hours, use 5 * 1 / 24

Second Rule

Here's the If statement for the second rule.

If statement for the second rule

Note

Code

Description

Priority equals Medium

Make sure you run this rule after you run the Pause for 90 Days rule.

If equals True

If all conditions in the If statement are true, then override the Pause for 90 Days rule.

Header is a DooSeededOrchestrationRules.DOOHeader and

Declare the Header variable, then load values into Header from the DOOHeader object of the DooSeededOrchestrationRules method.

DOOHeader contains order header attributes and their values.

Fline is a DooSeededOrchestrationRules.DOOFline and

Declare the Fline (fulfillment line) variable, then load values into Fline from the DOOFline object of the DooSeededOrchestrationRules method.

DOOFline (Distributed Order Orchestration Fulfillment Line) contains fulfillment line attributes and their values.

header.childFLines RL.contains fline

Declare the fline variable into the rules language (RL) dictionary, then set the value of fline to the value that childFLines contains.

This condition makes sure that the fline variable contains a child fulfillment line of the parent sales order that the orchestration process instance is processing. It also makes sure you correctly declare the variable into the dictionary.

flineEFF is a DOOSeededOrchestrationRules.FlexContext

Declare the flineEFF variable, then store the value of object FlexContext into this variable.

Note that the DooSeededOrchestrationRules method contains FlexContext.

flineEFF isn't null

Proceed to the next AND only if the flineEFF variable contains a value.

fline.flexContexts contains flineEFF

Proceed to the next AND only if flineEFF references an extensible flexfield on the fulfillment line.

To reference an extensible flexfield on the order header, use header.flexContexts instead of fline.flexContexts.

flineEFF.context isn't null

Proceed to the next AND only if the context contains a value.

flineEFF.context equals ignore case "Quote"

Proceed to the next AND only if context equals the string Quote.

flineEFF.getFlexAttributeDateValue("quoteexpiration") isn't null

Proceed to the THEN statement only if the Order Entry Specialist enters a value in the flexfield.

Here's the Then statement for the second rule.

Then statement for the second rule

Note

Code

Description

header.sacResult.sacType = DooSeededOrchestrationRules.SacResult.SAC_TYPE_TIMER

Set SacResult so it uses the timer.

header.sacResult.reevaluateFlag = "N"

Don't reevaluate the condition when the timer expires.

This rule doesn't evaluate according to a timer. Instead, it waits until the quote expiration date happens, so reevaluate isn't necessary.

If you submit a revision that includes a new value for the date, then the rule reevaluates the date and time, and sets this new time as part of compensation.

header.sacResult.waitDateTime = flineEFF.getFlexAttributeDateValue("quoteexpiration")

Set the waitDateTime variable of the sacResult rule set on the order header to the value that the Order Entry Specialist entered into the flexfield.

Learn how to use business rules with extensible flexfields. For details, see Overview of Setting Up Extensible Flexfields in Order Management.

Another Example That Uses Flexfields

Here's an example that pauses according to the value in a flexfield.

Here's an example that pauses according to the value in a flexfield.
Here's an example that pauses according to the value in a flexfield.