1.1.2 Code Parameter Fields

Code Parameter Fields

To code a parameter, first toggle the Code switch, located in the upper right side of the parameter’s text box. At this point, the text box becomes a JavaScript code field that has full capabilities, including access to the Kaholo SDK. This makes it possible to access Pipeline data such as statuses, Action results, trigger payloads, or configuration.

Each code field has full access to the same context as the main Code Page. For example, a simple variable name may be sufficient: awsRegion.

On the code page, the variable needs at minimum a value assigned of the correct type – for this example, a constant string.

const awsRegion = "ap-southeast-1"

Kaholo also exposes the Configurations for easy access in code.

var awsRegion = kaholo.execution.configuration.Region;

Parameters may also call functions from the code page.

function getRegion()  {
    if (getEnvironment() == "dev")  {
        return "us-west-1";
    return kaholo.execution.configuration.Region

Finally, parameters may contain the code themselves – even multi-line sections of code can be used.

((getEnvironment () == "dev") ? "us-west-1" : kaholo.execution.configuration.Region)

Page Contents