How You Use Custom Object Data in Rules

You can use rules to access or update data stored in a custom object created in the Oracle Fusion Customer Relationship Management Application Composer.

Example Use Case

Consider the following example use case for custom objects.

Assume that your company uses a catalog for export-controlled items. You need to assign your inventory items to the catalog based on complex rules that take into account both item attributes and non-item attributes, such as trade agreements. You maintain the item attributes as operational attributes and extensible flexfields in the Product Information Management work area. You maintain the trade agreement attributes in custom business objects designed using Application Composer.

Item rules can refer to both the item attributes and the non-item attributes, to determine if an item should be assigned to the export-controlled items catalog.

In Application Composer, you have defined a custom object called Selling Restrictions, containing a matrix of selling restrictions by target market. You want to refer to that data to determine whether or not an item can be sold, based on its target market. Assume that the example custom object Selling Restrictions contains the data in the following table.

Target Market

Restriction

EU

No

North America

Yes

APAC

Yes

Middle East

No

Your item rules can use complex business rules to determine attributes for assignment or validation purposes. You can shift some of the data-induced complexity for business rules, such as deriving the restriction for a target market, or deriving the color family name for a given color shade, to custom business objects and then refer to those values in your business rules. This practice of decoupling business rules from the underlying data protects your business rules from changes in data sets, such as color shades being added or dropped, and simplifies maintenance of your business rules.

Another use of custom objects with item rules is to use data available in legacy systems that may not have built-in web services. Relevant data from such systems can be extracted and maintained in custom objects and then be referred to in your item rules. This practice greatly enhances the scope of data used in your business rules.

Access Custom Object Data

To access the attributes maintained in custom objects, use the item rule function getCustomObjectValue().

The syntax for this function is:

getCustomObjectValue(
custObjName, 
custObjReturnAttrName, 
custObjQueryAttrName1, Value1,... 
custObjQueryAttrNameN, ValueN )

Referring to the preceding use case, the following example queries the Selling Restrictions custom object for the row of the Target Market column whose value is obtained from the attribute expression [ITEM].[Market Attributes].[Target Market] (for instance, North America), then fetches and returns the value of the row's Restriction column (for instance, Yes).

getCustomObjectValue(
"Selling Restrictions",
"Restriction",
"Target Market", [ITEM].[Market Attributes].[Target Market])

Update Custom Object Data

To update the attributes maintained in custom objects, use the item rule function updateCustomObjectValues().

The syntax for this function is:

Boolean updateCustomObjectValues(
custom_object_name, 
field_query_map, 
field_update_map)

Referring to the preceding use case, the following example queries the Selling Restrictions custom object for the row of the Target Market column whose value is obtained from the attribute expression [ITEM].[Market Attributes].[Target Market] (for instance, North America), then updates the row's Restriction value to No, and returns TRUE if the row was updated.

updateCustomObjectValues(
"Selling Restrictions", 
ToMap("Target Market", [ITEM].[Market Attributes].[Target Market]), 
ToMap("Restriction", "No") )