This article gives you a checklist on how to write codes for the Server Scripts and jobs in Vtiger CRM.
A
Abdul Sameer
19 Apr, 2024 - Updated
11 months ago
Writing Scripts
Scripts & Jobs are written in Javascript (ES5).
As of now, other programming languages are not supported.
All the code must be within the main() method. Anything outside this method will not execute.
The main method is invoked automatically and you do not need to call it.
You can utilize basic JavaScript methods like Math functions, JSON, String, etc.
You can also use helper methods provided like HTTP request methods, Vtiger’s REST API methods, and log methods for debugging.
Helper Methods
Following are a few helper methods provided which are available by default to make your work easier:
Debugging methods: To make coding easier and debug, there is a log() method. Logs added can be viewed while test execution and in script/job logs. You can also use JavaScript's console methods to debug.
HTTP request methods: To send HTTP requests to external services, methods are available (vtap.macro.http)
Vtiger REST API methods: To make REST API calls to the CRM instance, you can use vtap.macro.ws
To learn more about helper methods and see code in action, refer to the below examples