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.
What the Numbers Mean
-
You edit the predefined Fulfillment Line Information extensible flexfield. Order Management displays it when you click Actions > Edit Additional Information on the order line.
-
You create a flexfield context with a display name of Account Rule. The Additional Information dialog displays the context.
-
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.
-
You create a business rule that determines whether the segment contains the text Yes.
-
Order Management runs the rule when the user clicks Submit.
-
If the segment contains Yes, then the rule sets the Accounting Rule attribute to Immediate.
Summary of the Setup
-
Edit the flexfield.
-
Create your business rule.
-
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.
-
Go to the Setup and Maintenance work area, then go to the task.
-
Offering: Order Management
-
Functional Area: Orders
-
Task: Manage Order Extensible Flexfields
-
-
Open the Fulfillment Line Information flexfield for editing.
-
Click Manage Contexts, then add a new one.
Attribute
Value
Display Name
Accounting Rule
Code
Accounting_Rule
API Name
SetAccountingRuleToImmediate
-
Create a context usage.
Attribute
Value
Name
Additional Fulfillment Line Information
-
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.
-
Add an associated category.
Attribute
Value
Category
Additional Fulfillment Line Information
Code
DOO_FULFILL_LINES_ADD_INFO
-
Add an associated page.
Attribute
Value
Display Name
FulfillLineEFFInfo
Code
FulfillLineEFFInfo
Category
Additional Fulfillment Line Information
Usage
Additional Fulfillment Line Information
-
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.
What the Numbers Mean
-
Read your data.
-
Set up the category for the flexfield.
-
Set up the segment for the flexfield.
Read Your Data
What the Numbers Mean
-
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.
-
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.
-
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 |
---|---|
|
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. |
|
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. |
|
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. |
|
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. |
|
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.
|
|
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. |
|
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. |
|
Avoid a null pointer exception. Make sure the flineEFFCat variable contains a value. |
|
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. |
|
Place the flineEffSgmt variable under the flineEFFCat variable. This code establishes a hierarchy between the context code and the context segment.
|
|
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. |
|
Avoid a null pointer exception. Make sure the flineEffSgmt variable contains a value. |
Set Up the Category
Code |
Description |
---|---|
|
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. |
|
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. |
|
Avoid a null pointer exception. Make sure the flineEFFCat variable contains a value. |
Set Up the Segment
Code |
Description |
---|---|
|
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. |
|
Place the flineEffSgmt variable under the flineEFFCat variable. This code establishes a hierarchy between the context code and the context segment.
|
|
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. |
|
Avoid a null pointer exception. Make sure the flineEffSgmt variable contains a value. |
Create the Then statement.
Code |
Description |
---|---|
|
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
-
Go to the Order Management work area, create a sales order, and add an order line.
-
On the order line, click the Actions down arrow, then click Edit Additional Information.
-
Click Accounting Rule.
-
In the text box that's labeled Set Accounting Rule to Immediate, enter the text
Yes
. -
Click Submit.
-
On the Order page, click Billing and Payment Details.
-
In the Order Line Details area, click View > Columns > Accounting Rule.
-
Examine the order line and verify that the Accounting Rule attribute contains Immediate.