Skip to main content
adem_netsys
Explorer III
August 25, 2023
Solved

Playbook Variable

  • August 25, 2023
  • 3 replies
  • 5426 views

Hi guys,

 

How can I use the set variable value in a playbook I created in a different playbook?

    Best answer by dspille

    Hello Adem_netsys,

     

    The most common way this is done is by adding a parameter to your referenced (child ) playbook via Tools > Parameters.  Then you are able to pass specific variables to that playbook

     

    parameter.PNG

     
     

    When you call the child/reference playbook from the parent playbook, you are able to insert variables into the new parameter

    parent_variable.PNG

    call_reference.PNG

     

    Then back in the child playbook you can use the parameter using parameter.PNG

     

    When we run the playbook we can confirm that the variable was passed.

     

    playbook_execution.PNG

     

    I've attached this playbook to my comment so feel free to give it a try. Hope this helps!

    3 replies

    New Contributor III
    August 25, 2023

    Thanks for reaching out, please help share some more info, so that we can facilitate your ask.

     

    adem_netsys
    Explorer III
    August 25, 2023

    I have one playbook and it has a set variable value in it. I want to use this variable value in different playbooks.

    swolf
    Staff
    Staff
    August 25, 2023

    I think you need to expand on the use case. i.e. What's the use case for the playbooks? Why do you need to pass that data stored in the variable into another playbook? 

    To my knowledge, the only way that you could use that variable's value in another playbook, is if that playbook then calls another playbook (via referencing), and passes that variable into the referenced playbook.

    An alternative is it to pass the value of that variable into a global variable, or to store the data in a custom module, but I probably wouldn't recommend those without knowing the use case.

    New Contributor III
    August 25, 2023

    Thank you so much @swolf and @adem_netsys for your prompt reply. 

    In addition, please see Playbooks Guide https://docs.fortinet.com/document/fortisoar/7.4.1/playbooks-guide/331279/introduction-to-playbooks#Introduction_to_Playbooks


    Feel free to add on more details and our experts will pitch in.

     

    dspille
    Staff
    dspilleAnswer
    Staff
    August 25, 2023

    Hello Adem_netsys,

     

    The most common way this is done is by adding a parameter to your referenced (child ) playbook via Tools > Parameters.  Then you are able to pass specific variables to that playbook

     

    parameter.PNG

     
     

    When you call the child/reference playbook from the parent playbook, you are able to insert variables into the new parameter

    parent_variable.PNG

    call_reference.PNG

     

    Then back in the child playbook you can use the parameter using parameter.PNG

     

    When we run the playbook we can confirm that the variable was passed.

     

    playbook_execution.PNG

     

    I've attached this playbook to my comment so feel free to give it a try. Hope this helps!

    adem_netsys
    Explorer III
    August 26, 2023

    Hi Dylan,

     

    First of all, thank you very much for your concern. What is the difference between creating a global variable and giving a parameter?

    sjinturkar_FTNT
    Staff
    Staff
    August 29, 2023

    As name suggests Global Variable is global at FortiSOAR instance and it will be accessible and used by any playbook in the instance. Whereas parameter is local to that specific PB instance.