Home  >   VTAP Platform   >  Helper Method for Server Scripts and Jobs - Debugging

Helper Method for Server Scripts and Jobs - Debugging

A
Abdul Sameer
15 Mar, 2024 - Updated 1 month ago
Table of Contents

Debugging Methods

As developers, we need to write multiple variations of code to make sure it works perfectly. Often we print/log data to verify our logic, calculations are perfect. We print a request's response to extract required information. To help developers print data from code and test their script, debugging methods are provided.

To print any data may it be Number, String, Array or an Object, you can use 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);
    }
}
Was this article helpful?
0  out of  0  found this helpful.
Comments 0
Be the first to comment
© Copyright 2023 Vtiger. All rights reserved.