Documentation

1.1.1 Passing data between actions

You may pass data between actions  a few ways. Best way to getting familiar with all of them quickly at at once is to open on Kaholo platform one of the Template from the gallery, from the Basic Operations section called “Actions: passing output to next action”  There you can follow three ways of passing output from Action 1 to Action 2,3,4.

 

 

  1. Easiest way is to use. actions.<action-id>.results, within the field (switched to code). Let’s assume that Action1 from the picture has ID = “action1” then in order to get action1 results you should call it using actions.action1.result (on sample below concatenation with “echo ” word in order to print output to the console.

2. Second way is to use. actions.<action-id>.results, but inside a function in the code tab. There you may also process data before returing wanted result. Next when your function is created you need to call in the field in plugin name of the function.

 

     

LEARN MORE ABOUT FUNCTIONS IN KAHOLO

LEARN MORE ABOUT JAVASCRIPT FUNCTIONS

 

3. Third way to pass data, but applies only to Vaults, not actions itself is to create function that will return our secret value and call it inside wanted field. In this case you need to be aware about security risk. Secret values should stay hashed and shouldn’t be printed without specific purpose

 

       

 

Passing more complex result from other action – in JSON format:

Get the instanceID from an earlier Action in the Pipeline.

Let’s suppose an Action is meant to attach an elastic IP address to an AWS EC2 instance just created by an earlier Action with ID createInstance. The result set that is viewable in the Execution Results page in the Final Results window includes the Instance ID of the created instance. However, there’s no way to know this ID before the Action runs.

If you want to assign the IP to the correct instance, we must access the results from the previous Action using code, as illustrated below. In this example, createInstance is the name of that previous Action, and everything after .result. is determined by the JSON schema of the output of that Action.

actions.createInstance.result.runInstances.Instances[0].InstanceID

Page Contents