Add Promotional Items That Reward Your Customers
Add an item to a sales order to reward customers who purchase larger quantities.
For example, if your customer orders a quantity of 5 for the AS54888 desktop computer, then add a free AS9000 router on another order line on the same order.
Summary of the Setup
You can use an order management extension or a product transformation rule to add a promotional item. We recommend that you don't use an order management extension and a product transformation rule at the same time to do this.
-
Create an extension or create product transformation rule.
-
Test your setup.
Create an Extension
- Use the setProductNumber parameter of the createLineParams method to specify the item that you want to add.
- Use the setOrderedQuantity parameter of createLineParams to specify the quantity for the item that you want to add.
- Use an IF statement to specify the quantity that you want to use as the threshold that determines whether to add a new line.
- You can use createLineParams to set the ProductNumber, OrderedUOM, and OrderedQuantity attributes on new lines that you add. You can't use it to set any other attribute. You can use a posttransformation rule to set the value for other attributes.
For example:
import oracle.apps.scm.doo.common.extensions.CreateLineParams;
if (!"SUBMIT_AFTR_VALID".equals(header.getAttribute("CustomerPONumber"))) return; /* This line is only for testing purposes. Remove it after you successfully test this extension.*/
def createLineParams = new CreateLineParams();
createLineParams.setProductNumber("AS9000");
/* Specify the item.
that you want to add on the new line.*/
createLineParams.setOrderedUOM("Each")
createLineParams.setOrderedQuantity(1); /* Specify the quantity for the item that you're adding on the new line. */
def lines = header.getAttribute("Lines");
while (lines.hasNext()) {
def line = lines.next();
def isClosed = line.isClosed()
def isCanceled = line.isCanceled()
def isTransformed = line.isTransformed()
def transformLines = line.getTransformedLines();
if (isClosed || isCanceled || isTransformed || transformLines.size() != 0) {
continue;
}
if (line.getAttribute("ProductNumber") == "AS54888" && line.getAttribute("OrderedQuantity") >= 5)
/* Specify the quantity that you want to use as the threshold that determines when to add a new line. */
{
line.createNewLine(createLineParams);
}
}
For details, see Overview of Creating Order Management Extensions.
Create a Product Transformation Rule
Try it.
-
Get the IDs for the inventory items.
-
Do an SQL.
SELECT DISTINCT item_number, inventory_item_id FROM fusion.egp_system_items_b WHERE upper(item_number) LIKE '&ITEM_NUMBER%')
For details, see Use SQL to Query Order Management Data.
-
In the query result, locate the row that contains AS54888 in the ITEM_NUMBER column. Assume the query returns these values.
ITEM_NUMBER
INVENTORY_ITEM_ID
AS54888
300000001688530L
AS9000
300000003387164L
-
-
Go to the Setup and Maintenance work area, then go to the task:
-
Offering: Order Management
-
Functional Area: Orders
-
Task: Manage Product Transformation Rules
-
-
On the Manage Product Transformation Rules page, create a new rule.
Don't use Advanced Mode.
-
In the If area, set the conditions.
Code
Description
OrderTransformationRules.FulfillLineVO.InventoryItemId is 300000001688530L
FulfillLineVO is a virtual object that contains runtime values of the attributes on the fulfillment line. Order Management populates FulfillLineVO when you create the sales order.
This statement says to get the value of the InventoryItemId attribute. This attribute is in the FulfillLineVO virtual object (VO), and the OrderTransformationRules dictionary contains FulfillLineVO.
If the InventoryItemId attribute contains 300000001688530L, which is the AS54888 desktop computer, then proceed to the next condition in this rule. If it doesn't, then exit the rule.
OrderTransformationRules.FulfillLineVO.OrderedQty is same or more than 5
Get the value of the OrderedQty attribute.
If the OrderedQty attribute contains a value of 5 or greater, then proceed to the Then statement in this rule. If it doesn't, then exit the rule.
-
In the Then area, add a new action.
Code
Description
Assert New OrderTransformationRules.AddNewOrderLine
Add a new order line to the sales order.
newItemId: 300000003387164L
Add the 300000003387164L item, which is the Vision Router, to the order line.
You use Assert New to add a new object, such as a new order line.
viewRowImpl:OrderTransformationRules.FulfillLineVO.viewRowImpl
Use viewRowImpl:FLine.ViewRowImpl to specify the row that contains the runtime value.
-
Click Save > Release.
For details, see Overview of Using Business Rules With Order Management.
Test Your Setup
-
Go back to your other browser and create a sales order.
-
Add an order line.
Attribute
Value
Item
AS54888
Quantity
5 or more
-
Click Submit.
-
Verify that Order Management added a new order line.
Attribute
Value
Item
AS9000 Router
Quantity
1
Your Price
0