Define Object Functions

Use the following general procedure to create object functions:

Note: To define object functions and then schedule them, your role must include the ZCX_MANAGE_EXTENSIBLE_OBJECT_PRIV privilege.
  1. Sign in as an administrator.

  2. Ensure that you're in an active sandbox.

  3. Navigate to Application Composer.

  4. Expand the object for which you want to create a function, and then click Server Scripts.

  5. In the Server Scripts window, click the Object Functions tab.

  6. Click the Add a new Object Function icon.

    The Create Object Function page appears.

  7. In the Function Name field, enter a name for the object function. Ensure that the name has no spaces.

  8. If you want the function to return a value, in the Returns drop-down list, select a return type. Otherwise, retain the value as void, which is selected by default.

    The supported return types are the same as for global functions. See the Groovy Scripting Reference guide for more information.

    Note: If you're creating an object function to be used in a scheduled process and if you're defining the function to return values, you must select String as the return type.
  9. To change the visibility of the function from the default, use the Visibility drop-down list. See the Controlling the Visibility of an Object Function section in the Groovy Scripting Reference guide for more information.

  10. Optionally, to add parameters, in the Parameters section, click the Add Parameter icon and enter the name and type of the first parameter.

    The supported parameter types are the same as for global functions. See the Groovy Scripting Reference guide for more information.

    Note: Don't define any parameters if you're creating an object function to be used in a scheduled process. Object functions with input parameters aren't supported in scheduled processes.
  11. Repeat the previous step for any remaining parameters.

  12. Enter the Groovy code in the Edit Script window.

  13. Click Validate to validate the function.

  14. Click Save and Close.