Functions in Zoho Vertical Studio | Vertical Studio Help Guide

Functions

Functions are custom scripts in Vertical Studio that help address complex business requirements in your application. They are written using Deluge (Data Enriched Language for the Universal Grid Environment). 

The Deluge scripts can be used for a wide range of actions, including performing complex calculations, manipulating data, and interacting with both Zoho apps and third-party applications. It allows developers to handle processes beyond default functionalities, enabling them to create highly customized and efficient applications.

For more details, refer to our guide on Functions and Deluge Script

An Overview of Functions in Vertical Studio 

Functions can be created either as stand-alone scripts or associated with Buttons, Schedules, Related Lists and various components within the application. Following are the types of functions categorized based on it: 
  1. Standalone Function
  2. Button
  3. Related List
  4. Automation
  5. Schedule
  6. Validation Rule
  7. Variable Function
  8. Connector Function
  9. Signup Function
  10. Upgrade Function

Standalone Function

Standalone functions are independent scripts designed to perform tasks not directly associated with workflows or other components. These functions can be invoked using REST API calls, enabling external applications to interact with your application's data. You can create and manage standalone functions in the Developer Console under Build > Automate > Functions.

Following are the key details of a standalone function:
  1. Arguments and Return Types: Void, Integer, Float, String, Date, Map, Boolean, or List.
  2. Namespace: Always the domain of your application.
  3. Syntax: ReturnType namespace.function_name()

Button 

Button functions are triggered when a specific button is clicked within the application. Check the Custom Button help page to learn more details. 

Following are the key details of a button function:
  1. Namespace: button
  2. Return Type: String
  3. Argument: Map with the module name.
  4. Syntax: returnType nameSpace.function_name(map module_name)
Related list functions customize related lists to suit various business needs within a record in your application. For more information, refer to the Function Related List Help Page.

Following are the key details of a related list function:
  1. Namespace: related_list
  2. Return Type: String
  3. Argument: Map with the module name.
  4. Syntax: returnType nameSpace.function_name(map module_name)

Automation

Automation functions are linked to workflows and blueprints. They automate repetitive tasks and execute complex actions based on predefined triggers or conditions.

Following are the key details of an automation function:
  1. Namespace: automation
  2. Return Type: Void
  3. Argument: Map with the module name.
  4. Syntax: returnType nameSpace.function_name(map module_name)
Refer to the Workflow help document to learn more details about it.

Schedule

Functions associated with a schedule automate the execution of specific actions, either once or at recurring time intervals. Check the Schedules help document to learn more. 

Following are the key details of a schedule function:
  1. Namespace: schedule
  2. Return Type: Void
  3. Arguments: No arguments
  4. Syntax: returnType nameSpace.function_name()

Validation Rule

Functions associated with Validation rules help you validate field inputs based on custom business logic in your application. 

Following are the key details of a validation rule function:
  1. Namespace: validation_rule
  2. Return Type: Map
  3. Argument: String with CRM API request.
  4. Syntax: returnType nameSpace.function_name(string crmAPIRequest) 
Info
The Validation Rule function is currently in Early Access and not yet publicly available. Contact our support team to enable the feature for your account. 

Variable Function

Variable functions support On Change scripts to replace old variable values with new ones. It ensures the processes associated with the old variable value functions without any disruptions. 

Following are the key details of the On Change Script in variables:
  1. Namespace: VariableAction
  2. Return Type: Void
  3. Argument: Map variableMap (to retrieve the old and new values of the variable)
  4. Syntax: returnType nameSpace.function_name(map variableMap)
Check the Variables help document to learn more. 

Connector Function

You can invoke connector APIs using custom functions and enable seamless integration with third-party applications for data exchange and communication between your application and external services. 

Following are the key details of the connector function:
  1. Namespace: ConnectorAction
  2. Return Type: Void
  3. Arguments: No arguments
  4. Syntax: returnType nameSpace.function_name()
Refer to the Connector help guide to learn more about it. 

Signup Function 

The Sign Up Function enables developers to configure automated functions to be triggered when a user signs up for the application built using Vertical Studio. 

Following are the key details of the signup function:
  1. Namespace: Install_Function
  2. Return Type: Void
  3. Argument: Map signupMap (to fetch the organization ID)
  4. Syntax: returnType nameSpace.function_name(map variableMap)
For more details, check the Signup function help page.

Upgrade Function

The Upgrade Function is a startup action that automatically triggers when a subscriber is upgraded to a new version. 

Following are the key details of the upgrade function:
  1. Namespace: Install_Function
  2. Return Type: Void
  3. Argument: Map upgradeMap (to fetch the organization ID, previous version and current version)
  4. Syntax: returnType nameSpace.function_name(map upgradeMap)
Refer to the Upgrade function help page to learn more. 

Packaged Functions

Packaged Functions are created in the developer console and deployed to subscriber organizations during signup or through upgrades. Any new function that is created in the developer console will be included in the next version of the application.
To know more about packaging, please refer to our guide on Components Packaging in Zoho Vertical Studio.
The following table explains the upgrade behavior of an existing packaged function already deployed in the subscriber's organization.

Property
Upgrade Type
Modify Access
Function Name
Upgradable
Developer Only
Display Name
Upgradable
Developer Only
Description
Upgradable
Developer Only
Invoke as REST API
Non-Upgradable
Non-Editable
Return Type
Upgradable
Developer Only
Arguments
Upgradable
Developer Only
Deluge Code
Upgradable
Developer Only

With Stand-alone Functions, you can define arguments, specify a return type, and invoke the functions as a REST API. However, for functions associated with other components in the Developer Console, these properties cannot be defined.

Changes and Impacts

When a packaged Function is modified, published, and pushed as an upgrade to subscriber accounts, the effects on subscriber orgs vary depending on the changes made. Following is a detailed breakdown of the changes and its impacts:  

1. Editing a Function

Updates to the function’s Name, Description, and Display Name will not impact the associated components in the subscriber organizations.
Changes to the function's code, arguments, or return type can significantly impact the custom action it performs within the subscriber's organization. Depending on the extent of the modifications, subscribers may observe changes in the behavior or functionality of the custom action. 

2. Deleting a Function

Deleting a function would entirely disrupt the automation and other associated components in the subscriber organizations. 

Warning
Caution! 

Deleting a Function is a destructive change. It can have lasting effects on your subscriber data and configurations. Please consider the consequences carefully before proceeding, and only move forward if absolutely necessary.