Call function

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 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

1) Let's say we have defined a function in "Salary" application to calculate the average salary of a department:

int getAvgSalary(String designation)
{
avgSalary=Employee[Designation = designation].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 another application using the following snippet:

Average_Sales_Salary = Salary.getAvgSalary("Sales");

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com