Ir al contenido principal

Variables de automatización

Variables por automatización para almacenar y pasar datos entre pasos de automatización, scripts y condiciones de acción.

Introducción

Las variables de automatización permiten que las acciones pasen datos entre sí dentro de la misma canalización. Una acción escribe un valor en una variable — el código de salida de un script, un valor de campo personalizado, un resultado de parche — y una acción o condición posterior lo lee.

Las variables se limitan a la automatización en la que se definen. No se transfieren entre automatizaciones.


Creación de variables de automatización

Hay dos formas de crear una variable de automatización.

Desde la pestaña Variables

  1. Abra una automatización y haga clic enVariables en la barra lateral izquierda.

  2. Click + Add variable.

  3. Ingrese un nombre (sin espacios) y un valor predeterminado opcional.

  4. Click Guardar .

Automation Variables

Las variables creadas aquí están disponibles inmediatamente en todas las acciones y condiciones de la automatización.

Desde la salida de una acción

Cualquier acción puede escribir su salida en una variable en tiempo de ejecución.

  1. Abra una acción en modo de edición y desplácese hastaOpciones adicionales .

  2. In the Asignar salida de acción a variablecampo, ingrese un nombre de variable o seleccione uno existente.

  3. Guarde la acción.

Action Output Variable

NOTA: This is the same mechanism shown by the orange (x) badge on pipeline cards. If you see an (x) badge on an action, that action is reading from or writing to a variable.Using Variables


In Actions and Scripts

Anywhere variable rendering is supported, click the variable icon to insert a variable by name. You can also type the reference directly using double-curly-brace syntax:

In Action Conditions

##{{MyVariable}}

Variables can be read in action conditions to control whether a step runs. For example: only fire a Create Alert action if a variable named

equals PatchingStatus . failedSee

Condiciones de acción for the full reference on condition types and operators. Mapping to Script Variables

Script variables are named output slots defined in a script's

Variables tab. The script writes a value to a script variable during execution, and the mapping in the Run Script action panel determines which automation variable stores that value — making it available to subsequent actions and conditions in the pipeline. Script variables are for capturing output, not supplying input. To pass data

into a script (device context, custom field values, system info), use system variables or custom fields via the picker in the script editor. {x}To map a script variable to an automation variable:

Open the

  1. Run Script action in edit mode. In the

  2. Script variables section, find the script variable you want to capture. Open the

  3. Automation variables dropdown on that row. Select an existing automation variable or click

  4. Create new variable.When the script runs, the value it writes to that script variable is stored in the mapped automation variable and carried forward through the pipeline.

NOTA:

The Script variables section only appears when the selected script has at least one variable defined in its Variables tab.You can also set an automation variable inline from within a script. Use the inline syntax when your script produces other output you don't want polluting the variable (logs, status messages, etc.). Use

Asignar salida de acción a variable##{{variable=value}} when the script's only output is the value you want to capture. Embed this anywhere in your script output: Level's agent parses the script output for this pattern as the script runs. All other output passes through untouched. The variable must still be created in the script's Variables tab first.

SUGERENCIA:

##{{variable_name=value}}

This pattern — capture output → check it in a condition — is the standard way to build conditional failure handling in Level. See

Building Automations for a full walkthrough using this pattern. Preguntas frecuentesWhere can I see all variables available in an automation? Open the automation and click


Variables

  • in the left sidebar. This lists all automation variables defined for that automation. System variables are always available too but don't appear here — see System Variables for the full list. Can I use the same variable name in multiple automations? Yes. Variable names are scoped to the automation — in one automation has nothing to do with

  • in another. What value does a variable have before any action writes to it?PatchingStatus It uses the default value set when the variable was created. If no default was set, it's empty.PatchingStatus Can I read a variable from a previous automation run?

  • No. Variables reset at the start of each run. They don't persist between runs. It uses the default value set when the variable was created. If no default was set, it's empty.

  • Can I read a variable from a previous automation run? No. Variables reset at the start of each run. They don't persist between runs.

¿Ha quedado contestada tu pregunta?