Skip to main content
Contributor III
June 4, 2020

Technical Tip: FortiSOAR - Setting a global variable across different steps

  • June 4, 2020
  • 0 replies
  • 973 views

Description

 

This article describes how to define a variable that should be set multiple times.

 

Scope

 

FortiSOAR.

 

Solution

 

Consider an example scenario where the user is trying to get a value of a variable in two steps, but needs to use this variable later.

 

The playbook steps are functions, and it is necessary to define a global variable to be used across both functions.

 

In the case above, it is necessary to define a variable that should be set twice: once during the 'Get Search Result' step, and once during the 'Get Email Details' step. It is then necessary to create a condition based on the variable changed in either of the set steps mentioned before.

 

What happens is that the final decision step is only considering one variable of the two.

 

To create a global variable:

 

Access the value of the variable in each of the Set Variable steps by using {{ vars.step.stepName.variableName }}. For example: for the 'Get Search Result' step, use {{ vars.steps. Get_Search_Result.variableName }}.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.