<?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 Preprocess rule - link &amp;amp; run a script in the same rule in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/preprocess-rule-link-amp-run-a-script-in-the-same-rule/m-p/529599#M1762</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to configure pre-process rule to link and run preprocess script? I have to link incidents with few identical fields and set some fields values using script. I thought to make preprocess script which will do both, but I ran into a problem. As I see during preprocess&amp;nbsp;the incident doesn't have ID assigned yet, so I can't use command linkIncidents, because it requires ID of this incident.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 10:59:05 GMT</pubDate>
    <dc:creator>jakub_gawinkowski</dc:creator>
    <dc:date>2023-02-02T10:59:05Z</dc:date>
    <item>
      <title>Preprocess rule - link &amp; run a script in the same rule</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/preprocess-rule-link-amp-run-a-script-in-the-same-rule/m-p/529599#M1762</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to configure pre-process rule to link and run preprocess script? I have to link incidents with few identical fields and set some fields values using script. I thought to make preprocess script which will do both, but I ran into a problem. As I see during preprocess&amp;nbsp;the incident doesn't have ID assigned yet, so I can't use command linkIncidents, because it requires ID of this incident.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 10:59:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/preprocess-rule-link-amp-run-a-script-in-the-same-rule/m-p/529599#M1762</guid>
      <dc:creator>jakub_gawinkowski</dc:creator>
      <dc:date>2023-02-02T10:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Preprocess rule - link &amp; run a script in the same rule</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/preprocess-rule-link-amp-run-a-script-in-the-same-rule/m-p/530218#M1778</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/184204"&gt;@jakub_gawinkowski&lt;/a&gt;&amp;nbsp;– The pre-process rule actions are one-or-the-other: you can either have the pre-process rule Link/Link and close or Run a script, but not both. Custom pre-process scripts give you a lot of flexibility, but they can also be more difficult to troubleshoot than a playbook. For your use case, the best approach may be to handle the needed actions within the playbook rather than in a pre-process script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, the only way I've found to get the incident linking behavior you're looking for&amp;nbsp;&lt;EM&gt;within&amp;nbsp;&lt;/EM&gt;a pre-process script is to have the script actually create the incident, by running&amp;nbsp;&lt;STRONG&gt;createNewIncident&lt;/STRONG&gt;, in place of the incoming incident, because that way you can get the incident ID from the result of&amp;nbsp;&lt;STRONG&gt;createNewIncident&lt;/STRONG&gt;. I am attaching a proof-of-concept script that shows how this works for your reference. &lt;STRONG&gt;Please be sure to read the warning in the description carefully and test this out in dev first, because the script can send your server into an infinite loop if the pre-process rule is not filtered correctly.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 00:33:56 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/preprocess-rule-link-amp-run-a-script-in-the-same-rule/m-p/530218#M1778</guid>
      <dc:creator>asawyer</dc:creator>
      <dc:date>2023-02-08T00:33:56Z</dc:date>
    </item>
  </channel>
</rss>

