Skip to main content
Esteemed Contributor III
Jun 4, 2020 4:27 PM UTC

Technical Note: [FortiSOAR / Cybersponse Tricks'n'Tips] Testing whether Steps variable is Empty before setting it

  • Apr 16, 2026 11:11 AM UTC
  • 0 replies
  • 876 views
  • Translate All
Description

I am trying to find a record using some conditions from the emails module


image



In the retrieve email body step I am trying to set the variable this way


image


Testing whether the value includes anything and hence setting its value otherwise doing nothing.


I am facing this error


image


I think is caused by not finding the Required emailm however isn't the defined condition in the if condition supposed to avoid this issue?





Instead of using 'is defined' simply use this way {% if vars.steps.Copy__of_Find_Emails%} {{vars.steps.Copy__ofFind_Emails[0]}} ...... 


for. eg - {%if vars.result.asset_iri %} {{vars.result.asset_iri}}{%else%}None{%endif%}  



Looking at this it tells that vars.steps.Copy__of_Find_Emails  is defined and it's is dict not list as we are expecting it to be list by using vars.steps.Copy__of_Find_Emails[0] . 


However, to understand what is going on, setting any dict in the if clause automatically sets it as a condition to if its Null or Not

 


Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024