Object Functions for Business Objects

An object function is useful for encapsulating business logic for a specific business object. After you define an object function, you can call the function by name from other scripts related to the business object.

To create an object function rule for a business object:

  1. Select the business object for which you want to create the rule.

  2. Select the object's Business Rules tab.

  3. Click the Object Functions tab.

    You see a list of all object functions that are defined for the business object.

  4. Click + New Object Function and enter a name to identify the object function. You can modify this later if you want.

  5. Click Create Object Function in the dialog box to open the editor.

  6. In the Properties pane, click Parameters and add parameters for your function.
    Description of bo-object-function.png follows
    Description of the illustration bo-object-function.png

    When you are done, click All Properties.

  7. Create your function by typing in the editor and by using the Business Object and Functions palettes. Use the palettes to help you add fields and functions that you might use to create your function.

    Click the arrow next to the function or value in the palette to insert it at your insert cursor in the editor. When you select a function in the palette, a description of the function and example of how to use it are displayed in the palette.

    When you create an object function on an object named Department, the following are true by default:
    • Other scripts on the same object can call it.
    • Any script written on another object that obtains a row of type Department can call it.
    You can alter some of this default behavior by changing some of the properties in the Properties pane.
    • If the Callable by External Systems property is enabled, an external system working with a Department object will be able to invoke your object function. Enable this when the business logic it contains should be accessible to external systems. If you do not enable this property, then the object function can only be called by some other script on the Department object.

      If you call an object function via REST API from an external system, you'll need to set the value of the Content-Type header to application/vnd.oracle.adf.action+json. Note that this Content-type value is not the same as the value used for actions on a business object, for example, a POST action (application/vnd.oracle.adf.resourceitem+json).

      When the Callable by External Systems property is enabled, you can optionally override the default Groovy timeout specified in the Timeout Override field.

    • Enable the Privileged property to indicate that the object function should run with the data security visibility of a privileged user. This can be necessary to enable the business logic to see rows of business object data when the current user might not have the right to access the data. If the Privileged property is not enabled, the script can only query rows that the current user has the right to access.

  8. Click the Object Functions tab again to add your function and exit the editor.