Choose where you’d like to start

Call function

Note: This task is applicable only to Zoho Creator.

Overview

The call function Deluge task is used to invoke a custom function defined in any Creator application in your account.

Return

Based on how the function is defined, it might or might not return a value.

The data-type of the returned value will be the data-type specified for the function while defining it.

Syntax

To invoke a function which returns a value, from current application

<variable> = thisapp.<function_name>(<parameters>);

To invoke a function which does not return any value, from current application

thisapp.<function_name>(<parameters>);

To invoke a function which returns a value, from different application in same account

<variable> = <application_link_name>.<function_name>(<parameters>);

To invoke a function which does not return any value, from different application in same account

<application_link_name>.<function_name>(<parameters>);
ParamExplanation
<variable>

Variable to hold the returning value.

You can also specify a field name here, in the format input.<field_link_name>, to assign the returning value directly to the field.

<function_name>
Name of the function to be invoked.
<parameters>

Usage of this param depends on arguments specified or not while defining the function.

An argument is a variable declared while defining a function. It is used to refer to a value provided as input while invoking the function. The input value is being referred as parameter here.

You can specify a variable or an expression which can be evaluated to a value as a parameter, or you can also specify a field name as a parameter, in the format input.<field_link_name>.

The number of parameters and their data-types should be same as those of arguments while defining the function. If there's a mismatch, the script will not get saved.

<application_link_name>Link name of the application in which the function has been defined.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateYes
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Example

Let us consider an Employee Management Creator application with the form 'Employee_Details', which has fields like Name, Department, Designation, and Salary. Within this application, we've created a 'getAvgSalary' function to compute the average salary of a department using the following script:

int getAvgSalary(String input_department) 
{ 
avgSalary=Employee_Details[Department = input_department].avg(Salary); 
return avgSalary
}

We can invoke the defined function for the "Sales" department in the same app using the following snippet:

Average_Sales_Salary = thisapp.getAvgSalary("Sales");

We can invoke the defined function for the "Sales" department in different Creator application using the following snippet:

Average_Sales_Salary = Empolyee_Management.getAvgSalary("Sales");

Get Started Now

Execute