<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Flow Designer Script Check if variable is null in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2916973#M520065</link>
    <description>&lt;P&gt;No worries, once you select an Item from the Conditions, the variable option appears in the condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesChun_1-1714683608330.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/353018i5C4FABA1AF1F228F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JamesChun_1-1714683608330.png" alt="JamesChun_1-1714683608330.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I confirmed the functionality works in my PDI but noticed that it does take a minute or two for the Flow to detect that the variables have been updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, in the previous script, there is a semi-colon that should be deleted&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if ((candidateFound) &amp;amp;&amp;amp; (cityLocation) &amp;amp;&amp;amp; (stateLocation) &amp;amp;&amp;amp; (startDate))&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt; {&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 May 2024 21:42:57 GMT</pubDate>
    <dc:creator>James Chun</dc:creator>
    <dc:date>2024-05-02T21:42:57Z</dc:date>
    <item>
      <title>Flow Designer Script Check if variable is null</title>
      <link>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2914645#M519937</link>
      <description>&lt;P&gt;In all transparency, I am not great at scripting.&amp;nbsp; I am using the scripting function in flow designer and I need help checking if my variables are null.&amp;nbsp; if they are not null I would like the workflow to go to the next step.&amp;nbsp; Below is where I started and I got stuck, please assist in any way possible.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; candidateFound = fd_data.trigger.request_item.variables.candiate_found.getDisplayValue();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; cityLocation = fd_data.trigger.request_item.variables.city.getDisplayValue();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; stateLocation = fd_data.trigger.request_item.variables.u_state.getDisplayValue();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; startDate = fd_data.trigger.request_item.variables.start_date.getDisplayValue();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((candidateFound == &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;amp;&amp;amp; (cityLocation == &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;amp;&amp;amp; (stateLocation == &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;amp;&amp;amp; (startDate == &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;)); {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;false;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am assuming if it returns true then it will proceed to the next step.&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jewell&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 20:11:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2914645#M519937</guid>
      <dc:creator>jaubert</dc:creator>
      <dc:date>2024-04-30T20:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Flow Designer Script Check if variable is null</title>
      <link>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2914670#M519938</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/204886"&gt;@jaubert&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do this without any code at all.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add&amp;nbsp;&lt;EM&gt;Get Catalog Variables from Acess, and&amp;nbsp;&lt;/EM&gt;populate them as something like the below. Make sure you&amp;nbsp;&lt;EM&gt;select&lt;/EM&gt; all the variables needed&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesChun_0-1714509276303.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/352393iD68FB806AF4E82D0/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JamesChun_0-1714509276303.png" alt="JamesChun_0-1714509276303.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Use 'IF' flow logic to check if the variables from the previous step are empty or not.&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesChun_1-1714509329565.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/352394i283E5D9118ACA38E/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JamesChun_1-1714509329565.png" alt="JamesChun_1-1714509329565.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If you are keen on the script, something like the following will do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var candidateFound = gs.nil(fd_data.trigger.request_item.variables.candiate_found);
var cityLocation = gs.nil(fd_data.trigger.request_item.variables.city);
var stateLocation = gs.nil(fd_data.trigger.request_item.variables.u_state);
var startDate = gs.nil(fd_data.trigger.request_item.variables.start_date);

if ((candidateFound) &amp;amp;&amp;amp; (cityLocation) &amp;amp;&amp;amp; (stateLocation) &amp;amp;&amp;amp; (startDate)); {
    return false;
} else {
    return true;
}&lt;/LI-CODE&gt;&lt;P&gt;Note that this will return false when ALL variables are empty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 20:39:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2914670#M519938</guid>
      <dc:creator>James Chun</dc:creator>
      <dc:date>2024-04-30T20:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Flow Designer Script Check if variable is null</title>
      <link>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2916508#M520030</link>
      <description>&lt;P&gt;Thank you for your response.&amp;nbsp; If I use the no code solution proposed will this also allow me to pause until the variables are no longer empty?&amp;nbsp; The "wait for condition" only allows me to select a table that is why I was using the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jaubert_0-1714656003925.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/352896i38DB9E97BC98C311/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jaubert_0-1714656003925.png" alt="jaubert_0-1714656003925.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 13:20:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2916508#M520030</guid>
      <dc:creator>jaubert</dc:creator>
      <dc:date>2024-05-02T13:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Flow Designer Script Check if variable is null</title>
      <link>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2916973#M520065</link>
      <description>&lt;P&gt;No worries, once you select an Item from the Conditions, the variable option appears in the condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesChun_1-1714683608330.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/353018i5C4FABA1AF1F228F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JamesChun_1-1714683608330.png" alt="JamesChun_1-1714683608330.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I confirmed the functionality works in my PDI but noticed that it does take a minute or two for the Flow to detect that the variables have been updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, in the previous script, there is a semi-colon that should be deleted&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if ((candidateFound) &amp;amp;&amp;amp; (cityLocation) &amp;amp;&amp;amp; (stateLocation) &amp;amp;&amp;amp; (startDate))&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt; {&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 21:42:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/flow-designer-script-check-if-variable-is-null/m-p/2916973#M520065</guid>
      <dc:creator>James Chun</dc:creator>
      <dc:date>2024-05-02T21:42:57Z</dc:date>
    </item>
  </channel>
</rss>

