<?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 setPlaybook + Post-Processing in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/setplaybook-post-processing/m-p/1237011#M4139</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="77" data-end="91"&gt;Hi everyone,&lt;/P&gt;
&lt;P data-start="93" data-end="215"&gt;I have a Post-Processing script that uses the &lt;CODE data-start="139" data-end="152"&gt;setPlaybook&lt;/CODE&gt; command to switch the incident to a playbook called &lt;CODE data-start="205" data-end="212"&gt;test1&lt;/CODE&gt;.&lt;/P&gt;
&lt;P data-start="217" data-end="422"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="217" data-end="422"&gt;The problem is that when I close the incident, the script doesn’t run just once - it keeps setting the same playbook repeatedly, and as a result the &lt;CODE data-start="366" data-end="373"&gt;test1&lt;/CODE&gt; playbook is triggered about 10 times in a row.&lt;/P&gt;
&lt;P data-start="424" data-end="441"&gt;Here’s my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary"&gt;
&lt;DIV class="sticky top-9"&gt;
&lt;DIV class="absolute end-0 bottom-0 flex h-9 items-center pe-2"&gt;
&lt;DIV class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="overflow-y-auto p-4" dir="ltr"&gt;try:&lt;BR /&gt;# Run the test1 playbook&lt;BR /&gt;result = demisto.executeCommand("setPlaybook", {"name": "test1"})&lt;BR /&gt;return_results(True)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;return_error(f"Error: {str(e)}")&lt;/DIV&gt;
&lt;DIV class="overflow-y-auto p-4" dir="ltr"&gt;&lt;CODE class="whitespace-pre! language-python"&gt;&lt;/CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-start="646" data-end="868"&gt;My question is:&lt;BR data-start="661" data-end="664" /&gt;How can I make sure the playbook is set only once, and avoid it running multiple times during closing?&lt;BR data-start="782" data-end="785" /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P data-start="870" data-end="890"&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Mon, 01 Sep 2025 06:00:38 GMT</pubDate>
    <dc:creator>NivNet</dc:creator>
    <dc:date>2025-09-01T06:00:38Z</dc:date>
    <item>
      <title>setPlaybook + Post-Processing</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/setplaybook-post-processing/m-p/1237011#M4139</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="77" data-end="91"&gt;Hi everyone,&lt;/P&gt;
&lt;P data-start="93" data-end="215"&gt;I have a Post-Processing script that uses the &lt;CODE data-start="139" data-end="152"&gt;setPlaybook&lt;/CODE&gt; command to switch the incident to a playbook called &lt;CODE data-start="205" data-end="212"&gt;test1&lt;/CODE&gt;.&lt;/P&gt;
&lt;P data-start="217" data-end="422"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="217" data-end="422"&gt;The problem is that when I close the incident, the script doesn’t run just once - it keeps setting the same playbook repeatedly, and as a result the &lt;CODE data-start="366" data-end="373"&gt;test1&lt;/CODE&gt; playbook is triggered about 10 times in a row.&lt;/P&gt;
&lt;P data-start="424" data-end="441"&gt;Here’s my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary"&gt;
&lt;DIV class="sticky top-9"&gt;
&lt;DIV class="absolute end-0 bottom-0 flex h-9 items-center pe-2"&gt;
&lt;DIV class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="overflow-y-auto p-4" dir="ltr"&gt;try:&lt;BR /&gt;# Run the test1 playbook&lt;BR /&gt;result = demisto.executeCommand("setPlaybook", {"name": "test1"})&lt;BR /&gt;return_results(True)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;return_error(f"Error: {str(e)}")&lt;/DIV&gt;
&lt;DIV class="overflow-y-auto p-4" dir="ltr"&gt;&lt;CODE class="whitespace-pre! language-python"&gt;&lt;/CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-start="646" data-end="868"&gt;My question is:&lt;BR data-start="661" data-end="664" /&gt;How can I make sure the playbook is set only once, and avoid it running multiple times during closing?&lt;BR data-start="782" data-end="785" /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P data-start="870" data-end="890"&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2025 06:00:38 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/setplaybook-post-processing/m-p/1237011#M4139</guid>
      <dc:creator>NivNet</dc:creator>
      <dc:date>2025-09-01T06:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: setPlaybook + Post-Processing</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/setplaybook-post-processing/m-p/1237928#M4145</link>
      <description>&lt;P&gt;I would add a validation to check if the playbook has been already set before setting it up again.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Sep 2025 17:42:34 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/setplaybook-post-processing/m-p/1237928#M4145</guid>
      <dc:creator>pagnihotri</dc:creator>
      <dc:date>2025-09-14T17:42:34Z</dc:date>
    </item>
  </channel>
</rss>

