Use custom JavaScript in REST function expressions to define complex logic directly within parameters, headers, errors, and transformations. JavaScript enables advanced data manipulation, conditional logic, and formatting beyond the capabilities of standard expressions, offering greater flexibility and control when integrating with external REST APIs.
Configuration
Create the JavaScript file in Jigx Builder in the scripts/expressions folder.
Reference the expression in the function file. Use IntelliSense to select the required JavaScript expression.
Example and code snippets
The coalesce export function in the JavaScript code below returns the first non-null, non-undefined, and non-empty-string value from the list of candidates provided. If none of the candidates are valid (i.e., all are null, undefined, or empty string), it returns undefined.