Skip to main content

Inline Functions

Standalone functions in Zoho CRM allow you to execute a function within another function. These inline functions remove duplicate code and facilitate code reuse.

There are two main methods for using and implementing standalone functions:

  1. Without Parameters
  2. With Parameters

1. Without Parameters

To create a standalone function

  1. Go to Setup > Developer Hub > Functions.
  2. In the Functions page, click + Create New Function.
  3. Choose the Category of the function. In our case, choose "Standalone".
  4. Click Create.
  5. In the Create Function page, enter the following code.

    /* STANDALONE FUNCTION */
                    response = 'This is a test.';
                    return response;
  6. Click Save. Your function is now ready to be called using the function namespace.

Setting Up Requesting Function

  1. Go to Setup > Developer Hub > Functions.
  2. In the Functions page, click + Create New Function.
  3. Choose a Category of the function.
  4. Click Create.
  5. In the Create Function page, enter the following code.

    /* REQUESTING FUNCTION */
                    standalone_function_values = standalone.standaloneTest();
                    info standalone_function_values;
  6. Click Save & Execute.
  7. You can see the response of the standalone function printed in the console.

2. With Parameters

To set up a function with parameters:

To create a standalone function

  1. Go to Setup > Developer Hub > Functions.
  2. In the Functions page, click + Create New Function.
  3. Choose the Category of the function. In our case, choose "Standalone".
  4. Click Create.
  5. In the Create Function page, enter the following code.

    /* STANDALONE FUNCTION */ 
                    response = zoho.crm.getRecordById("module_api_name",record_id); //Use the module's API name here
                    return response;
  6. Click Edit Argument next to the function's namespace.
  7. enter "record_id" under Function Arguments, and choose the type as string.
  8. Click Save. Your function is now ready to be called using the function namespace.

Setting Up Requesting Function

  1. Go to Setup > Developer Hub > Functions.
  2. In the Functions page, click + Create New Function.
  3. Choose a Category of the function.
  4. Click Create.
  5. In the Create Function page, enter the following code as shown.

     /* REQUESTING FUNCTION */
                    standalone_function_with_parameter_values = standalone.funcWithParam(record_id);
                    info standalone_function_with_parameter_values;
  6. Click Save & Execute.
  7. Enter the ID of any record from the module you specified in the standalone function.
  8. You can see the response of the standalone function printed in the console.