Reusable code, smaller functions and tighter coding make it much easier to debug problems. In order to ensure reusable code across all Zoho functions, use Standalone functions and then call them when needed from inside other scripts. To do this, create a “Standalone” function (ie “convertDateFormat()”, then from within your other function, call it like so:
myVariable = standalone.convertDateFormat()
In this way, you write code ONCE, and then maintain in ONE file!
It is important to note that this Standalone function will simply import the script into the variable. As a very simple example, In have set up a standalone function for the dateProcessor above
Then I can call this Date processor in another script, like so:
It is really important to note that if you build Standalone functions, it is important to let your team know how to use them!
A good way to do this is using comments in the standalone function (which can even include the sample script to use!)
And last, but not least, add this to the REST API – so you can also access it via the API if required! While this is a REALLY simple example, even extremely complex functions can be used like this, so don’t write code – reuse it!