Item Rule Object Functions
You can use these functions to access or update data stored in custom objects created in the Oracle Fusion Customer Relationship Management Application Composer.
getCustomObjectValue
Syntax:
getCustomObjectValue(
custObjName,
custObjReturnAttrName,
custObjQueryAttrName1, Value1,...
custObjQueryAttrNameN, ValueN )
Fetches a value from attributes of a custom object custObjName
that's defined using Application
Composer. The value is fetched from the field named custObjReturnAttrName
of the custom object.
The custom object instance to fetch the value from is identified by
matching Value1
in the field named custObjQueryAttrName1
, using the ==
operator. Value1
can be a literal value, or can refer to an attribute, such as [ITEM].[AG1].[A1]
. You can specify additional
matching criteria by providing matches for custObjQueryAttrNameN
against ValueN
, and so on.
updateCustomObjectValues
Syntax:
updateCustomObjectValues(
custom_object_name,
field_query_map,
field_update_map,
return_attr_value)
Updates one or more values of custom_object_name
, a custom object that's defined using
Application Composer.
-
The custom object row containing the values to update is identified by
field_query_map
, which is a map of name/value pairs using theToMap
function, whereToMap("Seq", 235)
specifies a row of the column Seq with the value 235. -
In the identified row, the columns to update are identified by
field_update_map
, whereToMap("Active","NO")
updates the value of the column Active with the value NO. Thefield_update_map
can contain multiple name/value pairs to update multiple columns in the same row. -
The
return_attr_value
names the column of the queried row whose value is returned by the function. -
This function returns TRUE if custom object rows were found and updated, and FALSE if no custom object row matching the query attributes was found.
Example custom object: MachineCode
This example custom object is used in the following function examples.
Seq |
Code |
Active |
Hour_Rate |
---|---|---|---|
1 |
A20 |
YES |
200 |
2 |
M10 |
YES |
500 |
3 |
X40 |
YES |
30 |
Example: Update a single custom object field
The following example queries the MachineCode custom object row whose Seq field is 2, updates its Active field to NO
, and returns TRUE if the row was updated:
updateCustomObjectValues("MachineCode", ToMap("Seq", 2), ToMap("Active", "NO"))
Example: Update multiple custom object fields
The following example performs the same query and
update as the preceding example, but additionally updates the Hour Rate field to 10
:
updateCustomObjectValues("MachineCode", ToMap("Seq", 2), ToMap("Active", "NO", "Hour Rate", 10))
Example: Update a custom object field and return a value
Assume that an item has the attribute [ITEM].[MACHINE_DETAILS].[SL_NUMBER]. Create a rule with the following expression in the Return Value field of the rule:
updateCustomObjectValue("MachineCode",ToMap("Seq", [ITEM].[MACHINE_DETAILS].[SL_NUMBER]), ToMap("Active", "NO"),Hour_Rate))
That expression:
-
Queries the Seq column of the MachineCode custom object to find the row that matches the value of the item's SL_NUMBER attribute
-
In that row, updates the value of the Active column to NO.
-
From that row, returns the value of the Hour_Rate column (to the Return Value field of the item rule).
InvokeGlobalFunction
Syntax:
InvokeGlobalFunction(global_function_name,
global_function_param1,
global_function_param2, ...,
global_function_paramN)
Calls a global function global_function_name
that's defined using Application Composer. You pass zero or more
parameters to the global function as global_function_param1
through global_function_paramN
. Returns
a value that can be used for assignment or validation. You can write
a Groovy script inside the global function that invokes a web service
to access internal or external data or to perform a calculation on
your data.
For more information about defining global functions, see these Oracle Fusion Cloud Applications guides:
-
Configuring Applications Using Application Composer
-
Groovy Scripting Reference
Example:
The following example calls a global function my_global_concat_func()
that takes three string
parameters, and returns the concatenation of those strings:
InvokeGlobalFunction("my_global_concat_func", "Hello",", ","world!")
Output:
Hello, world!
This table indicates how data types can be used between item rules and global functions:
Type |
Passed as parameters |
Returned as values |
---|---|---|
String |
Yes |
Yes |
Long (Integer) |
Yes |
Yes |
Double (floating point) |
Yes |
Yes |
Date |
Yes |
Yes |
Boolean |
Yes |
Yes |
Object |
No |
No |
List |
No |
No |
Map |
No |
No |
void |
N/A |
No |