FortiSOAR Discussions
mwisener
New Contributor

Playbooks that use "agent" step connector not able to pass vars

Hello,

 

Assume this structure:

 

Parent Playbook has a reference to Child Playbook in one of it's steps.

The Child Playbook has a "connector" action (in this case, Active Directory v2.4.0)

The connector action is set as "agent" and is performing some lookup.

 

All the steps in the Child Playbook succeed and the last step is a "set variables" step that sets output variables:

output  = {{ vars.output }} or whatever it might be.

 

In the Parent Playbook, in the Reference Child Playbook step, we are attempting to access those variables and they will always be Null (or not set) no matter what if we have an agent step in a playbook.

 

I.e. child_output = {{ vars.result.output }} 

 

Even though we can see that vars.result.output in the ENV, the assignment will always end up with NULL in the parent playbook. This only happens if the called playbook has an AGENT step.

 

Is there some limitations I'm not aware of? Any documentation that might explain this?

 

FortiSOAR 7.6.0

 

THANKS!

3 REPLIES 3
snikam
Staff
Staff

Hi

Variables declared in child playbooks cannot be directly accessed in parent playbooks regardless of connector action executed on agent.
There are two ways to achieve this:

1. Add set variable step as last step in reference(child) playbook.

2. In the parent playbook, create a variable and store the output of the reference (child) playbook step in it.
3. This variable created in parent playbook storing the output of child playbook can be used anywhere in parent playbook.
OR
You can create a global variable and set the value of global using the utility connectors step in the child playbook and retrieve the value of the same global variable in the parent playbook.


Sunil Nikam
mwisener
New Contributor

Thanks for the response snikam. I'm failing to properly communicate the issue. 

I'm aware you can't directly reference child variables in parent playbook. I do indeed attempt to "pass" results back up to the parent via a "set vars" last step in the child, then reference those vars in the parent using {{ vars.result.whatever }} on the "Reference Playbook Step"

 

All that works, EXCEPT when there is an agent connector in the child playbook. The variables are passed up to the parent and you can SEE it when investigating the ENV in the parent, but if you attempt to use that var anywhere in the parent playbook, you can't (it's assigned as null). It's like a child playbook that has an agent connector is somehow scoped and you can't access the vars even if you can SEE them in the ENV.

 

Thanks,

 

\- Mike

snikam

Yes, it seems an issue when using the connector step with agent configuration in the child step.
Thank you so much for pointing it out. We will fix it in an upcoming release.
Meanwhile, as a workaround, please continue referring step output directly instead of storing it in a variable.

Regards,
Sunil

Sunil Nikam