Custom Functions | Zoho RPA help

Custom Functions

Custom functions are reusable scripts written in Deluge, the scripting language used by Zoho. They allow you to automate complex tasks and calculations beyond what the native features offer. Think of them as tools you build yourself, specifically tailored to your unique needs.

Create a Custom Function

From the Settings Page:

  1. Navigate to Settings > Custom Functions.
  2. Click Create Custom Function.
  3. Define the Function Name:
    1. Start with a letter or an underscore.
    2. Use only alphanumeric characters and underscores.
    3. Examples : _discount_calculation_1, autofill_zipcode.
  4. Optional: Click Function Gallery (top right) to access prebuilt functions.
  5. Select a Return Type: Choose the desired output data type for the function.
  6. Specify Input Parameters: Include parameters required by the function and their respective data types.
  7. Click Create.
  8. Enter the Deluge Script:
    1. Use the deluge editor to write the code for your function. You can also drag and drop prebuilt functions from the left pane.
Tip: For built-in function help, click the Built-in Function Reference link at the top, or use the help icon.

From the RPA Flow Builder:

  1. Open the RPA Flow builder.
  2. Click the Logic tab on the left.
  3. Click Custom Functions > Create Custom Function.
  4. Follow the same steps as described in the "From the Settings Page" section above.

Edit a custom function

From the Settings Page:

  1. Navigate to Settings > Custom Functions.
  2. Click the Edit button next to the desired function.
  3. Modify the input parameters, return type, or deluge script as needed.
  4. Click Save to apply the changes.
Note: If you modify function parameters or return types, ensure they are properly configured in flows using the function. Otherwise, errors may occur.

From the RPA Flow Builder:

  1. Click the Logic tab on the flow builder, then click on Custom functions.
  2. Click the Pencil icon next to the function name.

  3. Edit the Deluge script as needed.
  4. Click Save to apply the changes.

Test a Function

You can test your custom function to ensure that it is working as expected by providing a sample input.

From the Settings Page: 

  1. Navigate to Settings > Custom Functions.
  2. Locate the desired function and click the Test button next to it.

  3. If the function requires input parameters, a window will appear.Enter the required input values for each parameter, then click Execute.
The Input, Output, and Info tabs will display the results of the execution.

From the RPA Flow Builder

  1. Click the Logic tab on the flow builder, then click on Custom functions.
  2. Click the Pencil icon next to the function name you want to test.
  3. Click the Execute button at the bottom of the editor window.
  4. If the function requires input parameters, a window will appear.Enter the required input values for each parameter, then click on Execute.
The Input, Output, and Info tabs will display the results of the execution.

Copy a Function

Duplicating a custom function allows you to create a copy of an existing function, so that you can experiment with different code without worrying about affecting the original script. This is useful if you want to create variations of a function, or if you want to test different approaches to a particular problem.
  1. Navigate to Settings > Custom Functions.
  2. Locate the desired function and click the Copy button next to it.

  3. The name of the function will be auto-populated, example: copy_of_invoice. you can edit the name if required.
  4. Click the Create Copy button to create the copy of the function.