Passer au contenu principal

Variables d'automatisation

Variables par automatisation pour stocker et transférer les données entre les étapes d'automatisation, les scripts et les conditions d'action.

Introduction

Les variables d'automatisation permettent aux actions de transmettre des données les unes aux autres dans le même pipeline. Une action écrit une valeur dans une variable — le code de sortie d'un script, la valeur d'un champ personnalisé, un résultat de correctif — et une action ou une condition ultérieure la lit.

Les variables sont limitées à l'automatisation dans laquelle elles sont définies. Elles ne se reportent pas entre les automatisations.


Création de variables d'automatisation

Il y a deux façons de créer une variable d'automatisation.

À partir de l'onglet Variables

  1. Ouvrez une automatisation et cliquez surVariables dans la barre latérale gauche.

  2. Click + Add variable.

  3. Entrez un nom (pas d'espaces) et une valeur par défaut facultative.

  4. Click Enregistrer .

Automation Variables

Les variables créées ici sont disponibles immédiatement dans toutes les actions et conditions de l'automatisation.

À partir de la sortie d'une action

Toute action peut écrire sa sortie dans une variable au moment de l'exécution.

  1. Ouvrez une action en mode édition et faites défiler jusqu'àOptions supplémentaires .

  2. In the Assigner la sortie de l'action à une variablechamp, entrez un nom de variable ou sélectionnez une existante.

  3. Enregistrez l'action.

Action Output Variable

REMARQUE : 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

Conditions d'action 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.

REMARQUE :

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

Assigner la sortie de l'action à une 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.

CONSEIL :

##{{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. FAQWhere 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.

Avez-vous trouvé la réponse à votre question ?