How to Pass Variables Between Parent and Child Dashboards
Last updated
Last updated
There are two ways to pass variables between parent and child dashboards:
Input Variables
Update Variables action
Input Variables are way to pass variables from Parent to Child Kanban only.
Input Variables are passed to Child Dashboard immediately when they are loaded in the parent one.
These variables can be:
already defined on child dashboard. When Input Variables has the same names as variables configured in child kanban, their values override values of proper variables in child dashboard
new custom variables
To set Input Variables select a Child Dashboard on the Composite Kanban editor and click "add" link in the properties sidebar:
A Variable entry form will appear. If selected child dashboard has variables configured, their names will be added to Name field picker:
You can select one of these names. If you want to add other variable, select "...Custom" option - pickilst will transform to text input and you can type desired variable name. Enter necessary value or use ">>" button to show assistive Formula Editor. Click "Remove Variable" button to deleteariable entry:
Save Kanban. Now, when it will be opened, these input variables will be passed to child Kanban.
This action uses Kanban API "Update variables" method. It works for any Kanban, so, we can do this action as for Child, as for Parent kanbans.
This action can't be executed automatically when Kanban is loaded, so, it should be set as a handler on some Child Kanban element:
This method requires two parameters: "variables" with necessary variables and their values in JSON format and "kanbans" with list of Kanban IDs or names (separated with comma or in JSON format):
The main trouble in using of this method is that kanban IDs is unknown by default (and will be changed by system while cloning, importing or deployment). Also Kanban name can be changed, become non-unique or too long. At east, it is not good idea to hardcode something dynamic.
Child Kanbans can have API names. They can be set in the child Kanban properties:
These API names can be used instead of Kanban IDs in various actions (like Update Variable) and will be usable even when IDs of kanbans were changed.
Since API names can be set only to Child Kanbans, in is no simple way to make parent Kanban a target for Kanban API actions.
In this case we can use Input Variables to pass parent Kanban ID (or name) to children:
Set some variable (e.g. name it "ChildVar") in parent Kanban
Set Input Variable for Child Kanban and give it "{$Kanban.ID} value
Configure some element with in Child Kanban. Give it a handler which will update some variable in the parent one, and set {$Variables.parentID} as value of "kanbans" parameter
Set "variables" parameter to some value (e.g, {"ChildVar":"Value_from_child_kanban"})
Now if click this child Kanban element it will trigger Update Variable action on target (parent) Kanban. You can know this using Debug Console:
See the Parent Kanban variable initial value
Close console and click on element to trigger "Update Variable" action
See the Parent Kanban variable new value:
You may not define a "ChildVar" variable on Parent Kanban - in this case it will have no initial value, but will be created when Update Variable action will be executed first time.