You have no disk or network access, and the VM will be killed after 1 second, which is plenty of time for most loops and workloads. Network access must be through separate Webhook steps.
This VM provides an ECMAScript 6 compatible JS. This means
available for use.
console.log can be used in the VM to log output, and this output will be
visible in the action event in the ticket itself. This can be extremely helpful
when debugging. The output from
console.log will be visible like this:
Additionally, we provide several built-in functions which extend the functionality of the VM. The functions are listed below with their descriptions.
||Converts a valid XML string into parsed JSON. Attributes are prefixed with an underscore “_” and enclosed text can be accessed with the key “#text”. It throws an exception if it fails.|
||Converts valid JSON (stringified or parsed) into a valid XML string. It throws an exception if it fails.|
Exceptions can be caught in try-catch blocks.
Thankful by default does not pass in or out any memories from the VM. You can
specifically pass a variable to the VM using the
In Memories and
sections above and below the JS textarea, respectively.
will be available as variables in the JS VM. The same memory can be both passed
in and passed out, indicating that the Execute JS step is modifying the memory.
Parse JSON checkbox, you can have all memories passed into the VM
converted to JSON for you. Without this checkbox, you’ll need to run the
following before trying access any JS object fields or arrays:
myMemory = JSON.parse(myMemory)
Note that Webhook response bodies can not be parsed as JSON, so you cannot use
Parse JSON checkbox when passing in webhook data. Manually parse the
responses in the VM when appropriate.