Use Flexfields to Set Attribute Values

Assume you must allow your Order Entry Specialists to enter a value in a flexfield to indicate they need to change the value of an attribute.

In discussions with your financials team and order entry managers, you determine that you will add a flexfield on the order line with a display name of Set Accounting Rule to Immediate. The Order Entry Specialist will enter the text Yes to indicate whether to change the accounting rule. The rule doesn't affect order processing. Financials uses it for billing purposes.

Here's the pseudocode for your rule.

If the Set Accounting Rule to Immediate flexfield contains Yes, then change the value of the Accounting Rule attribute to Immediate.

Here's how the flow works.

If the Set Accounting Rule to Immediate flexfield contains Yes, then change the value of the Accounting Rule attribute to Immediate.

What the Numbers Mean

  1. You edit the predefined Fulfillment Line Information extensible flexfield. Order Management displays it when you click Actions > Edit Additional Information on the order line.

  2. You create a flexfield context with a display name of Account Rule. The Additional Information dialog displays the context.

  3. You create a flexfield segment with a display name of Set Accounting Rule to Immediate. The Additional Information dialog displays the segment. The user can enter the text Yes in the segment.

  4. You create a business rule that determines whether the segment contains the text Yes.

  5. Order Management runs the rule when you click Submit.

  6. If the segment contains Yes, then the rule sets the Accounting Rule attribute to Immediate.

Summary of the Setup

  1. Edit the flexfield.

  2. Create your business rule.

  3. Test your set up.

1. Edit the Flexfield

You will display your attribute on the fulfillment line, the sales order displays the Fulfillment Line Information extensible flexfield on the fulfillment line, so you edit the Fulfillment Line Information flexfield.

Learn how to do this. For details, see Overview of Setting Up Extensible Flexfields in Order Management.

Try it.

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

    • Offering: Order Management

    • Functional Area: Orders

    • Task: Manage Order Extensible Flexfields

  2. Open the Fulfillment Line Information flexfield for editing.

  3. Click Manage Contexts, then add a new one.

    Attribute

    Value

    Display Name

    Accounting Rule

    Code

    Accounting_Rule

    API Name

    SetAccountingRuleToImmediate

  4. Create a context usage.

    Attribute

    Value

    Name

    Additional Fulfillment Line Information

  5. Create a context sensitive segment.

    Attribute

    Value

    Display Name

    Set Accounting Rule to Immediate

    Code

    Accounting_Rule_Segment

    API Name

    setAccountingRuleToImmSegment

    Value Data Type

    Character

    Description

    Segment of the extensible flexfield that allows the user to specify whether to set the Accounting Rule attribute to Immediate.

    Data Type

    Character

    Value Set

    10 Characters

    Prompt

    Set Accounting Rule to Immediate

    Display Type

    Text Box

    Instruction Help Text

    Enter the text Yes, and the sales order will set the Accounting Rule attribute to Immediate.

  6. Add an associated category.

    Attribute

    Value

    Category

    Additional Fulfillment Line Information

    Code

    DOO_FULFILL_LINES_ADD_INFO

  7. Add an associated page.

    Attribute

    Value

    Display Name

    FulfillLineEFFInfo

    Code

    FulfillLineEFFInfo

    Category

    Additional Fulfillment Line Information

    Usage

    Additional Fulfillment Line Information

  8. Deploy the Fulfillment Line Information flexfield. For details, see Set Up Extensible Flexfields in Order Management.

2. Create Your Business Rule

Here's the rule that you will create.

Create Your Business Rule

What the Numbers Mean

  1. Read your data.

  2. Set up the category for the flexfield.

  3. Set up the segment for the flexfield.

Read Your Data

Create an If statement in your business rule, then add variables to the rule

What the Numbers Mean

  1. Create an If statement in your business rule, then add variables to the rule. The orchestration process uses virtual objects to read data from the sales order into these variables at run time.

  2. You use the HeaderVO virtual object (VO) to read header data into the rule, such as values for the Customer attribute and the Contact attribute.

  3. You use the LineVO virtual object to read order line data into the rule, such as the values for the Item attribute and the Quantity attribute.

This set up can get complex. Learn about the code and what it means, including the hierarchy and virtual objects. For details, see Patterns That You Can Use with Extensible Flexfields in Business Rules.

Examine an example that explains how to create the rule, including stepwise details for establishing a hierarchy and all this other fancy stuff you need to do. For details, see Use Extensible Flexfields in Transformation Rules.

Here's an explanation of the code that you use in this example.

Code

Description

Header is a PostTransformationRules.HeaderVO

Declare the Header variable into the PosttransformationRules dictionary.

Get values for attributes of the order header that the orchestration process is currently processing from the Header virtual object (VO), then store them in the Header variable.

Line is a PostTransformationRules.LineVO

Declare the Line variable into the PosttransformationRules dictionary.

Get values for attributes of the order line that the orchestration process is currently processing from the Line virtual object (VO), then store them in the Line variable.

Header.OrderLine contains Line

Declare the OrderLine variable, then place it under the Header variable.

Copy the contents of the Line variable into the OrderLine variable.

This code establishes the hierarchy for your flexfield.

Fline is a PostTransformationRules.FulfillLineVO

Declare the Fline variable into the PosttransformationRules dictionary.

Get values for attributes of the order line that the orchestration process is currently processing from the FulfillLine virtual object (VO), then store them in the Fline variable.

Line.OrderFulfillLine contains Fline

Declare the OrderFulfillLine variable, then place it under the Header Line.

Copy the contents of the Fline variable into the OrderFulfillLine variable.

This code finishes the hierarchy for your flexfield, which is.

Header
  Line
    Fline

flineEFFCat is a PostTransformationRules.j_FulfillLineEffDooFulfillLinesAddInfoprivateVO

Declare the flineEFFCat variable into the PosttransformationRules dictionary.

Get values for attributes of the fulfillment line that the orchestration process is currently processing from the j_FulfillLineEffDooFulfillLinesAddInfoprivateVO virtual object (VO), then store them in the flineEFFCat variable.

j_FulfillLineEffDooFulfillLinesAddInfoprivateVO is a predefined object that Order Management uses to process details for an extensible flexfield that sits on an order line.

Fline.FulfillLineEffCategories is flineEFFCat

Use the FulfillLineEffCategories property to identify the flineEFFCat variable as a flexfield category.

To establish a hierarchy, this code places the flineEFFCat variable under the Fline variable.

flineEFFCat isn't null

Avoid a null pointer exception. Make sure the flineEFFCat variable contains a value.

flineEffSgmt is a PostTransformationRules.FulfillLineEffB Accounting_RuleprivateVO

Declare the flineEffSgmt variable into the PostTransformationRules dictionary.

Get values from the FulfillLineEffB Accounting_RuleprivateVO virtual object, then store them in flineEffSgmt.

The business rule gets this virtual object from the order line that the orchestration process is currently processing.

The business rule uses the pattern FulfillLineEffBxxxprivateVO to store details for your context code, where xxx identifies the context code that you created earlier in this procedure in the Setup and Maintenance work area. Namely, Accounting_Rule.

flineEFFCat.FulfillLineEffBAccounting_RuleprivateVO RL.contains flineEffSgmt

Place the flineEffSgmt variable under the flineEFFCat variable.

This code establishes a hierarchy between the context code and the context segment.

flineEFFCat 
  flineEffSgmt

flineEffSgmt.Accounting_Rule_Segment is "Yes"

Examine the value of the Accounting_Rule_Segment attribute in the flineEffSgmt variable.

See if it contains the text Yes.

Recall that Accounting_Rule_Segment is the value that you entered for the Code attribute when you created the context segment earlier in this procedure in the Setup and Maintenance work area.

flineEffSgmt.Accounting_Rule_Segment isn't null

Avoid a null pointer exception. Make sure the flineEffSgmt variable contains a value.

Set Up the Category

Code

Description

flineEFFCat is a PostTransformationRules.j_FulfillLineEffDooFulfillLinesAddInfoprivateVO

Declare the flineEFFCat variable into the PosttransformationRules dictionary.

Get values for attributes on the fulfillment line that the orchestration process is currently processing from the j_FulfillLineEffDooFulfillLinesAddInfoprivateVO virtual object (VO), then store them in the flineEFFCat variable.

j_FulfillLineEffDooFulfillLinesAddInfoprivateVO is a predefined object that Order Management uses to process details for an extensible flexfield that sits on an order line.

Fline.FulfillLineEffCategories is flineEFFCat

Use the FulfillLineEffCategories property to identify the flineEFFCat variable as a flexfield category.

To establish a hierarchy, place the flineEFFCat variable under the Fline variable.

flineEFFCat isn't null

Avoid a null pointer exception. Make sure the flineEFFCat variable contains a value.

Set Up the Segment

Code

Description

flineEffSgmt is a PostTransformationRules.FulfillLineEffB Accounting_RuleprivateVO

Declare the flineEffSgmt variable into the PostTransformationRules dictionary.

Get values from the FulfillLineEffB Accounting_RuleprivateVO virtual object, then store them in flineEffSgmt.

The business rule gets this virtual object from the order line that the orchestration process is currently processing.

The business rule uses the pattern FulfillLineEffBxxxprivateVO to store details for your context code, where xxx identifies the context code that you created earlier in this procedure in the Setup and Maintenance work area. Namely, Accounting_Rule.

flineEFFCat.FulfillLineEffBAccounting_RuleprivateVO RL.contains flineEffSgmt

Place the flineEffSgmt variable under the flineEFFCat variable.

This code establishes a hierarchy between the context code and the context segment.

flineEFFCat 
  flineEffSgmt

flineEffSgmt.Accounting_Rule_Segment is "Yes"

Examine the value of the Accounting_Rule_Segment attribute in the flineEffSgmt variable.

See if it contains the text Yes.

Recall that Accounting_Rule_Segment is the value that you entered for the Code attribute when you created the context segment earlier in this procedure in the Setup and Maintenance work area.

flineEffSgmt.Accounting_Rule_Segment isn't null

Avoid a null pointer exception. Make sure the flineEffSgmt variable contains a value.

Create the Then statement.

Code

Description

Assign Fline.AccountingRuleId = 11

The AccountingRuleId has a set of numeric values. Each value represents an accounting rule. The value 11 represents Immediate.

Make sure you release your rule.

3. Test Your Setup

  1. Go to the Order Management work area, create a sales order, and add an order line.

  2. On the order line, click the Actions down arrow, then click Edit Additional Information.

  3. Click Accounting Rule.

  4. In the text box that's labeled Set Accounting Rule to Immediate, enter the text Yes.

  5. Click Submit.

  6. On the Order page, click Billing and Payment Details.

  7. In the Order Line Details area, click View > Columns > Accounting Rule.

  8. Examine the order line and verify that the Accounting Rule attribute contains Immediate.