1.3.2 Functions

Functions

If you need to process or transform your output from Actions, you can do it from within functions that can be defined in the Code tab. There, you can use JavaScript functions to call results from Actions and return the values.

Here’s a simple example of a function that returns the output from an Action – and prepares the information to send to Slack:

function getSlackMessage(){
    return `New Instance ID: ${actions..result.Instances[0].InstanceId}`
}

To get the result of this function, you can call it by turning on the toggle switch above a parameter field.

getSlackMessage()

You can also access Vault items using functions. You can do this by using the async function.

async function getCmd(){
    return `echo ${await kaholo.vault.getValueByKey("Vault_name"}`
}

To get the result of this function, you can call it by turning on the toggle switch above a parameter field.

getCmd()