Functions are mostly used for the following reasons:
- Write once and reuse utilities:
Functions promote reusability of deluge or java script within an application or across your applications. Additionally, developers within your application can reuse these functions in other applications where they have developer permissions. 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.
- Bridge the gap between applications:
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 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.
- Integrate custom actions with reports:
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 report.