Functions

To define your own custom logic, you can add user-defined functions and actions to Attribute Groups without having to customize the entire page. By first setting up user-defined attributes, you can then execute user-defined functions with those attributes. You need to define functions only if you plan to have actions associated with your attribute groups.

Actions execute predefined PLSQL program units. You must write these program units, containing logic you want to execute on various events related to the attribute group, and load them to the database in apps schema. Register these program units as functions. Using different algorithms, you can calculate values by passing attribute values to functions. User-defined functions can be PL/SQL functions. Functions use input and/or output parameters of various data types such as string, integer, or Boolean. You can also map these parameters to attributes, object primary key values, and external attributes. Actions are trigger points for functions which trigger at specific events or are displayed as buttons or links on the page. You can also prompt the user based on the user's input.

Creating Functions

To create a user-defined function:

  1. On the Attribute Setup Workbench page, select the Functions tab.

  2. On the Search and Select: Functions page that displays, click Create Function.

  3. On the Attribute Setup Workbench: Functions page that displays, enter an Internal Name for the function.

  4. Enter a Display Name. This is the name of the function as it appears in the user interface.

  5. Enter a Description for the function.

  6. Select the Function Type from the list. The supported function type for CLM is PL/SQL. When you select PL/SQL as the function, then you must also specify the Package in which the procedure resides and the procedure that implements your custom logic.

    Note: Run the PL/SQL package in your custom schema and then create a synonym for this package in the APPS schema.

  7. Click Apply.

Deleting Functions

To delete a user-defined function:

  1. On the Attribute Setup Workbench page, select the Functions tab.

  2. On the Search and Select: Functions page that displays, select the function you want to delete and click Delete.

    Note: You can only delete a function when it is no longer associated with an action.

Creating Parameters for a Function

After creating a user-defined function, specify the parameters to pass when that function is called.

To create parameters for a function:

  1. On the Attribute Setup Workbench page, select the Functions tab.

  2. On the Search and Select: Functions page that displays, select the function for which you want to create parameters and click the Function Name.

  3. On the Function Details page that displays, you can view the Basic Information of the Functions. This includes the Internal Name, Display Name, Description, Function Type, and the details associated with the function type.

  4. Click Add.

  5. On the Create Function Parameter page, enter the Internal Name of the parameter.

    Note: The internal name of the parameter must match exactly (case sensitive) to the parameter name of the PLSQL procedure/function in the database.

  6. Enter the Display Name of the parameter as it appears in the user interface.

  7. Enter the Sequence. This is the order in which this parameter appears relative to other parameters associated with this function. Sequence must be unique among all parameters associated with this function. Specify the order sequence of the function parameters; this is the order in which the parameters are passed to a function or procedure.

  8. Select the Data Type from the list, which contains the available data types. The values available are dependent on the type of function for which you are defining parameters.

    Note: The data type of the parameter must match the data type of the corresponding PLSQL function or procedure parameter in the database.

  9. Select the Parameter Type for each parameter based on whether the corresponding attribute is providing an input parameter to the function or expecting a return value from the function (for example, input, output, input/output). The parameter options for a parameter depend on the function type and parameter data type you have already selected.

    The valid parameters for PL/SQL functions are:

  10. Click Apply.