Helper Method for Server Scripts and Jobs - Debugging
This article describes the Debugging helper method for Server Scripts and Jobs.
Abdul Sameer
19 Apr, 2024 - Updated
1 year ago
Debugging Methods
As developers, you need to write multiple variations of code to make sure it works perfectly. Often you print or log data to verify our logic, calculations are perfect. You print a request's response to extract the required information. To help developers print data from code and test their script, debugging methods are provided.
To print any data may it be a Number, String, Array or Object, you can use the log() method.
- Log method available for logging data in the code.
- Useful for displaying record details, user data passed to the main method, or HTTP request responses.
- Logs are shown in the CRM, aiding code writing and validation.
Notes: - Along with the provided log() method, you can also use javascript’s console methods (console.log, console.debug, console.info, console.warn and console.error).
- Logs added will be available in output and even in execution logs.
|
Example async function main(record, user) { try { var response = await vtap.macro.http.get(‘https://www.mywebsite.com’); log(response); } catch(error) { console.error(error); } } |