Skip to main content

Running Custom Code

You can write JavaScript to interact with inputs and utility libraries, which is useful for adding custom logic to your application services. In service designer you can use the Run JavaScript Code node to write your custom code. Altogic automatically injects predefined list of utility libraries and node input values to the code execution context.

Accessing Node Inputs

You can access the values of object, list or value inputs in your custom JavaScript code using their names. Please note that, trigger link points added to this node as input will not be injected, since these linkpoints to do not have any values. In below example, a single users model object is passed to Run JavaScript Code node execution context as pickedValue. You can access the value of this input by using the ctx.pickedValue keyword in your custom code.


To access the input link point values in your custom code, you need to prefix the input names with ctx keyword (e.g., ctx.input, ctx.request).


The Run JavaScript Node automatically imports the following utility libraries. You can use the keyword (e.g., moment, _, luxon) in your custom code to access the methods, classes and properties of these libraries.

Node Fetchfetch

You can directly use the await operator at your top level custom JavaScript code.