Coding Variables

When creating actions, an understanding of how variables work is important and not always immediately obvious. To the right of the editor, the Variables pane is found, as shown below, where the variables available to the file currently open in the editor are defined.

In the Variables pane, you see the Inputs section and the Outputs section, as outlined below.

Inputs Section#

The following variables are defined in the Inputs section.

  • context. You always need to have a context variable in your operation because that is Transposit's special variable giving you access to information such as the team name or the activity ID that you're running in.
  • input_param. Anything other than the context variable in the sidebar of an operation will be exposed to the runbook builder. One or more input parameters may be found here, defined by you or others working on the operation. In the example above, the input_param parameter has been explicitly defined by the operation developers, or is part of the template used to set up the operation, and will be displayed in the runbook builder for this operation.

During the runbook run, the input parameters outlined above are accessible via the inputs variable, shown below, which you can rename to any name, but is always received in the signature of the operation, from where it can be processed:

def execute(inputs):
# Retrieve parameters
input_param = inputs.get("input_param")

Outputs Section#

The execute operation is special because you are able to define outputs, as can be seen in the lower part of the Variables pane above, where the Outputs section is found. The Outputs section shows what your operation is going to output.

Currently, if you create a new operation, the Outputs section will be shown, without content. This is a bug because these outputs do not do anything because the newly created untitled operation is not the execute operation, which is one specific operation marked as such in the Deploy tab. However, to be able to access values from the input in any operation, you need to define those inputs in the Inputs section of the newly created untitled operation, as well as any other operation, such as the execute operation.