Understand custom functions
A function is a set of deluge statements grouped together, which can be invoked within an application whenever required. Use functions to structure deluge scripts in a modular way. Related functions can be grouped under a common category, called a namespace.
Functions are mostly used for the following reasons:
Write once and reuse utilities
Functions promote reusability of deluge script within an application or across applications created by the same user. This makes the code modular and easy to understand. If you want to repeat certain scripting functionality across different parts of an application, you can define it as a function and reuse it. Use the built-in functions provided in deluge to create numerous utility functions on your own.
Serves as bridge between applications (created by the same user)
In addition to defining generic utilities as functions, you can also use functions to manipulate the application data. Until recently, it was not possible to manipulate data in one application using deluge scripts in another application. This is now possible using functions. We can consider the application and its data as an object and we define functions to operate on this data (compare this to member functions in an object-oriented world view). The applications can communicate with each other using functions.
Custom action integration in views
Functions can be integrated into various GUI actions, taking scripting integration in Zoho Creator to the next level. Functions are integrated into reports as custom actions. This enables the user to invoke a specific function on selected records in a view.
- A function calling itself (also known as recursive function) cannot be called more than 75 times. If the limit of 75 is exceeding, a "Call Stack limit exceeded" error will be thrown.