Use Extensible Flexfields in Line-Selection Rules

Use the DooSeededOrchestrationRules object to reference an orchestration process when you use an extensible flexfield in a line-selection rule.

Assume you need this rule:

  • If the order line contains a reward item, then use it when running this orchestration process step.

You use this logic:

Object

Description

Pattern

Use these patterns:

  • Root: DooSeededOrchestrationRules.DOOHeader

  • header is a DooSeededOrchestrationRules.DOOHeader

  • fline is a header/childFLines

  • flineEFF is a header/childFLines/flexContexts

Test

Use these tests:

  • flineEFF.context.equalsIgnoreCase("Item_Information") is DooSeededOrchestrationRules.Boolean.TRUE

  • flineEFF.getFlexAttributeValue("_Reward_Item") isn't null

Note

  • If you know the argument's absolute value, then the equalsIgnoreCase function is optional.

  • The getFlexAttributeValue() function on the flexContexts object looks up the flexfield's value.

Action

Use this Assert New action:

  • DooSeededOrchestrationRules.Result (resultObjKey:FLine.fulfillLineId)

This logic creates this hierarchy:

Order Header
  childFLines
    flexContext

where

  • Order Header is the root.

  • childFLines is a child of Order Header.

  • flexContext is a child of childFLines and a grandchild of Order Header.

This example uses Tree Mode to maintain the hierarchy rather than explicitly creating the hierarchy. The forward slash (/) specifies the hierarchy. For example:

  • header/childFLines/flexContexts

You will set up a line selection criteria in an orchestration process so it specifies which orchestration process steps to run for each order line. You set it up according to the value that the flexfield contains. You create this rule:

  • If the Export Compliance status is Not Passed for an order line, then manually examine the line. Send other order lines directly to shipping.

You will create this flow:

flow for Using Extensible Flexfields in Line-Selection Rules

You use the flexfield to store the value of the compliance status:

Context

Extensible Flexfield

Object

Value

Compliance

Compliance_Status

Fulfillment Line EFF (DOO_FULFILL_LINES_ADD_INFO)

Not Passed

You will create this line-selection rule:

rule for Using Extensible Flexfields in Line-Selection Rules

Summary of the Steps

  1. Create the rule.

  2. Establish the object hierarchy.

  3. Select lines according to flexfield context.

  4. Select lines according to compliance status.

  5. Identify the order line that you need to manually examine.

For background, see Overview of Using Business Rules With Order Management.

This topic uses example values. You might need different values, depending on your business requirements.

Create the Rule

  1. Go to the Setup and Maintenance work area, then go to the task:

    • Offering: Order Management

    • Functional Area: Orders

    • Task: Manage Orchestration Process Definitions

  2. On the Manage Orchestration Process Definitions page, locate the orchestration process you must edit, then click Actions > Edit.

  3. On the Edit Orchestration Process Definitions page, in the Process Details area, in the Step Definition list, add a step.

    Attribute

    Value

    Step Name

    Compliance Check

    Step Type

    Service

    Task Type

    DOO_TradeCompliance

    Task

    DOO_TradeCompliance

    Service

    Request Screening for Trade Compliance

  4. In the row you just added, in the Line-Selection Criteria column, click Click for Rule.

  5. In the Line-Selection Criteria dialog, click Add Rule > Properties, then set the values.

    Attribute

    Value

    Name

    Examine Compliance Status

    Description

    If the Export Compliance status is Not Passed for an order line, then perform a manual examination.

    Effective Date

    Always

    Priority

    Medium

    Active

    Contains a check mark.

    Advanced Mode

    Contains a check mark.

    Tree Mode

    Contains a check mark.

    Use tree mode so you can include the flexfield in the orchestration rule's root hierarchy.

  6. Set the root.

    Attribute

    Value

    Root

    DooSeededOrchestrationRules.DOOHeader

Establish the Object Hierarchy

You must establish this object hierarchy so the rule filters the data it processes:

Order Header
  childFLines
    flexContexts

where

  • Order Header is the root.

  • childFLines is a child of Order Header.

  • flexContexts is a child of childFLines and a grandchild of Order Header.

This example uses Tree Mode to maintain the hierarchy rather than explicitly creating the hierarchy. Each forward slash (/) specifies a hierarchy level.

header/childFLines/flexContexts

where

  • header is the root. The root makes sure the rule processes data only in the child object that references the root.

  • childFLines is the child. The child makes sure the rule processes data only in the grandchild object that references the child.

  • flexContexts is the grandchild.

You will create this If statement. It establishes the object hierarchy:

statement that establishes the object hierarchy

Establish the object hierarchy.

  1. In the If area, delete the value in the field to the left of Is A, and then enter this value.

    Attribute

    Value

    Field to the left of Is A

    Header

  2. In the field to the right of Is A, set the value.

    Attribute

    Value

    Field to the right of Is A

    DooSeededOrchestrationRules.DOOHeader

  3. Under the field that contains header, add a check mark to the option that selects the test, click Cut > Cut.

    For example:

    copying the test in the rule

    The hierarchy includes the extensible flexfield variables, so its not necessary to include tests when you define the hierarchy.

  4. Click Add Pattern.

  5. In the field to the left of Is A, enter the value.

    Attribute

    Value

    Field to the left of Is A

    Fline

  6. In the field to the right of Is A, set the value.

    Attribute

    Value

    Field to the right of Is A

    header/childFLines

  7. Click Add Pattern.

  8. In the field to the left of Is A, enter the value.

    Attribute

    Value

    Field to the left of Is A

    FlineEFF

  9. In the field to the right of Is A, set the value.

    Attribute

    Value

    Field to the right of Is A

    header/childFLines/flexContexts

Select Lines According to Flexfield Context

You will add this test:

  • If the flexfield's context is Compliance

This text will select lines only where the flexfield context is Compliance.

You will create an expression.

Left Expression

Operand

Right Expression

FLineEFF.context.equalsIgnoreCase("Compliance")

Is

DooSeededOrchestrationRules.Boolean.TRUE

Select lines according to flexfield context.

  1. Under the pattern you just added, click Add Test.

    You will add the test criteria that identifies order lines that proceed through compliance testing. If the attributes you reference are optional, then you include null value checks to avoid a null pointer exception at run time.

  2. Click Left Value.

  3. In the Condition Browser, click Expression Builder.

  4. In the Expression Builder, click Functions, expand FLineEFF > Context, click equalsIgnoreCase(String), then click Insert Into Expression.

    For example:

    expanding the folders until you can view the functions of the context object

    To navigate the tree structure, expand the folders until you can view the functions of the context object. FlineEFF is the pattern you declared earlier.

    The context you expand is a fact in the FlineEFF pattern. It includes functions you can use to perform a variety of calculations. Therefore, the expression you create includes the pattern, fact, and function.

  5. In the window near the top of the dialog, replace the word String with the context for your extensible flexfield condition. In this example, replace String with Compliance.

    For example:

    defining context for your extensible flexfield condition
  6. Click OK > OK.

  7. Click Right Value.

  8. In the Condition Browser, expand DooSeededOrchestrationRules > Boolean, then click TRUE > OK.

    For example:

    setting boolean value in browser

Select Lines According to Compliance Status

You will add a test.

  • If the value of the flexfield attribute named Compliance Status is Not Passed

You will create an expression.

Left Expression

Operand

Right Expression

flineEFF.getFlexAttributeValue("_Compliance_Status")

Is

"Not Passed "

Select lines according to Compliance Status.

  1. In the test you just added, immediately to the right of the Right Value magnifying glass, click the down arrow, then click Simple Test.

  2. Click Left Value.

  3. In the Condition Browser, click Expression Builder.

  4. In the Expression Builder, click Functions, click FlineEFF.getFlexAttributeValue(String), then click Insert Into Expression.

    For example:

    Selecting lines according to Compliance Status
  5. In the window near the top of the dialog, replace the word String with the name of the flexfield attribute.

    You must use an underscore to prefix the attribute name in a function. The attribute name is Compliance_Status, so you use _Compliance_Status.

    For example:

    adding status in expression
  6. Click OK > OK.

  7. In the field to the right of Is, enter "Not Passed".

    You must include the double quotation marks ( " ).

    Make sure your rule contains tests.

    Left Expression

    Operand

    Right Expression

    FLineEFF.context.equalsIgnoreCase("Compliance")

    Is

    DooSeededOrchestrationRules.Boolean.TRUE

    flineEFF.getFlexAttributeValue("_Compliance_Status")

    is

    "Not Passed"

Identify the Order Line That You Need to Manually Examine

You will create a statement.

Identifying the That Requires Manual Examination

where

  • Result is a fact in the DooSeededOrchestrationRules dictionary.

  • resultObjKey is a property of the Result fact.

  • resultObjKey stores the value that this rule uses to identify the order line that requires manual examination.

  • Fline is a fact in the DooSeededOrchestrationRules dictionary that contains order line attributes.

  • fulfillLineID is an order line attribute.

Identify the order line that requires manual examination.

  1. In the Then area, click Add Action > Assert New.

  2. Click Select a Target > DooSeededOrchestrationRules.Result.

  3. Click Edit Properties.

  4. In the Properties dialog, in the resultObjKey row, click Value.

  5. In the Condition Browser, expand Fline, click fulfillLineID, then click OK.

  6. Make sure the Properties dialog looks like this:

    using the Properties dialog
  7. Click OK

  8. In the Line-Selection Criteria dialog, click Save.

  9. On the Edit Orchestration Process Definition page, click Save.