<?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>topic Re: Generate context inside a while loop in an automation in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509777#M1070</link>
    <description>&lt;P&gt;inside a while loop?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2022 10:09:27 GMT</pubDate>
    <dc:creator>Josep</dc:creator>
    <dc:date>2022-07-25T10:09:27Z</dc:date>
    <item>
      <title>Generate context inside a while loop in an automation</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509773#M1068</link>
      <description>&lt;P&gt;An Api call is created in an automation program. The call to the API needs to wait for a value to set to "FINISHED", so a while loop is created waiting for this value. However, I'd like to know the current status of this value setting the value in context.&lt;/P&gt;
&lt;P&gt;Why is not setting this value on the context?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;status=""&lt;/P&gt;
&lt;P&gt;While status != "FINISHED":&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;status=doHttpRequest()&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;demisto.setContext("status", status)&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 09:52:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509773#M1068</guid>
      <dc:creator>Josep</dc:creator>
      <dc:date>2022-07-25T09:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Generate context inside a while loop in an automation</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509776#M1069</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arnarayanan_0-1658743481388.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/42591i23B4F57BA9E82C34/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="arnarayanan_0-1658743481388.png" alt="arnarayanan_0-1658743481388.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;demisto.setContext("status", "test")&lt;/P&gt;
&lt;P&gt;Something like the above worked for me&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:06:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509776#M1069</guid>
      <dc:creator>arnarayanan</dc:creator>
      <dc:date>2022-07-25T10:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Generate context inside a while loop in an automation</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509777#M1070</link>
      <description>&lt;P&gt;inside a while loop?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:09:27 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509777#M1070</guid>
      <dc:creator>Josep</dc:creator>
      <dc:date>2022-07-25T10:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Generate context inside a while loop in an automation</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509778#M1071</link>
      <description>&lt;P&gt;Did not test it inside a while loop.&lt;/P&gt;
&lt;P&gt;The recommended way to do it is to return a scheduled command and not through a while loop.&lt;BR /&gt;&lt;A href="https://xsoar.pan.dev/docs/integrations/scheduled-commands" target="_blank" rel="noopener"&gt;https://xsoar.pan.dev/docs/integrations/scheduled-commands&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also, calling an API from an automation is&amp;nbsp; kind of an anti-pattern(although it is possible). Usually, the automation will call an integration command that calls the API.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:14:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509778#M1071</guid>
      <dc:creator>arnarayanan</dc:creator>
      <dc:date>2022-07-25T10:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Generate context inside a while loop in an automation</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509779#M1072</link>
      <description>&lt;P&gt;Interesting, I'll study how to implement&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:18:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/generate-context-inside-a-while-loop-in-an-automation/m-p/509779#M1072</guid>
      <dc:creator>Josep</dc:creator>
      <dc:date>2022-07-25T10:18:05Z</dc:date>
    </item>
  </channel>
</rss>

