<?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: Automation to query incident team from current and linked incidents in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572780#M2989</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/306775"&gt;@Martin_Wiethan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is going to be a bit complicated so hopefully I can explain the process I would take to accomplish your goal.&lt;/P&gt;
&lt;P&gt;From your explanation, my understanding is that there is one incident that is linked to multiple incidents, and you want to create a list of users for all of incidents.&lt;/P&gt;
&lt;P&gt;The first part of automation is to get a list of incident IDs that you want to find users for. For this, I would run this in the automation:&lt;BR /&gt;res = demisto.executeCommand("getIncidents", {"id": 1})&lt;BR /&gt;incident = res[0]["Contents"]['data'][0]['linkedIncidents']&lt;BR /&gt;This should return a list of linked incident IDs.&lt;/P&gt;
&lt;P&gt;Then you can loop through each incident running&amp;nbsp;demisto.executeCommand("getIncidents", {"id": x}) and get user for each incident with&amp;nbsp;res[0]["Contents"]['data'][0]['owner']&lt;/P&gt;
&lt;P&gt;The last step is to send out an email from the same automation using demisto.executeCommand('send-mail') and specify parameters of the command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jan 2024 22:38:38 GMT</pubDate>
    <dc:creator>yuki_sato</dc:creator>
    <dc:date>2024-01-11T22:38:38Z</dc:date>
    <item>
      <title>Automation to query incident team from current and linked incidents</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/570603#M2926</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;TLDR: How can i write an automation that returns the incident team of multiple investigation ids (1,2,[...]) without needing to run the automation manually in each investigation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create an automation to send an E-Mail to all users in the incident team of the current incident, as well as all linked incidents.&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;To achieve this for a single incident, i can use the &lt;A href="https://xsoar.pan.dev/docs/reference/api/demisto-class#investigation" target="_self"&gt;demisto.investigation()&lt;/A&gt; function to extract the users in the incident team of the current investigation via the 'users' key.&lt;/P&gt;
&lt;P data-unlink="true"&gt;To map the the usernames to their configured e-mail also quite easy using the default getUserByUsername automation.&lt;/P&gt;
&lt;P data-unlink="true"&gt;To get a list of all the linked incidents is also not a problem because the data is stored in the normal incident context.&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;The problem im facing right now is, that&amp;nbsp;&lt;A href="https://xsoar.pan.dev/docs/reference/api/demisto-class#investigation" target="_self"&gt;demisto.investigation()&lt;/A&gt;&amp;nbsp;dosn't seem to allow an investigation id to be provided to query another investigation and not the one currently opened, so i would have to run the automation in each investigation manually.&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;Does anyone have an idea or a solution on how to work around that?&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;&lt;LI-PRODUCT title="Cortex XSOAR" id="Cortex_XSOAR"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 09:08:24 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/570603#M2926</guid>
      <dc:creator>Martin_Wiethan</dc:creator>
      <dc:date>2023-12-21T09:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Automation to query incident team from current and linked incidents</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572780#M2989</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/306775"&gt;@Martin_Wiethan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is going to be a bit complicated so hopefully I can explain the process I would take to accomplish your goal.&lt;/P&gt;
&lt;P&gt;From your explanation, my understanding is that there is one incident that is linked to multiple incidents, and you want to create a list of users for all of incidents.&lt;/P&gt;
&lt;P&gt;The first part of automation is to get a list of incident IDs that you want to find users for. For this, I would run this in the automation:&lt;BR /&gt;res = demisto.executeCommand("getIncidents", {"id": 1})&lt;BR /&gt;incident = res[0]["Contents"]['data'][0]['linkedIncidents']&lt;BR /&gt;This should return a list of linked incident IDs.&lt;/P&gt;
&lt;P&gt;Then you can loop through each incident running&amp;nbsp;demisto.executeCommand("getIncidents", {"id": x}) and get user for each incident with&amp;nbsp;res[0]["Contents"]['data'][0]['owner']&lt;/P&gt;
&lt;P&gt;The last step is to send out an email from the same automation using demisto.executeCommand('send-mail') and specify parameters of the command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 22:38:38 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572780#M2989</guid>
      <dc:creator>yuki_sato</dc:creator>
      <dc:date>2024-01-11T22:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Automation to query incident team from current and linked incidents</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572861#M2991</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/263375"&gt;@yuki_sato&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your Solution would provide me only with the "Owners" of all the linked Incidents which is not exactly what i want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The user list i'm interested in, is the list of users Including Owner and Participants. Pretty much the contents of the default "Team Members" Layout section but for all linked incidents. For a single incident this list can be retrieved by running&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;demisto.investigation()['users']&lt;/LI-CODE&gt;
&lt;P&gt;The problem i encountered is, that (as far as i know) the participants of an investigation are only stored in the investigation data and &lt;A href="https://xsoar.pan.dev/docs/reference/api/demisto-class#investigation" target="_blank" rel="noopener"&gt;demisto.investigation()&lt;/A&gt; dosn't accept any arguments (not like &lt;A href="https://xsoar.pan.dev/docs/reference/api/demisto-class#incidents" target="_blank" rel="noopener"&gt;&lt;SPAN class="token plain"&gt;demisto&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token plain"&gt;incidents&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token plain"&gt;incidents&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;None&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/A&gt;) so i don't know (if possible) how to access the investigation data of multiple incidents in a single automation&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 12:14:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572861#M2991</guid>
      <dc:creator>Martin_Wiethan</dc:creator>
      <dc:date>2024-01-12T12:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automation to query incident team from current and linked incidents</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572881#M2992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/306775"&gt;@Martin_Wiethan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I spent a good amount of looking into this. Oddly enough, team members associated to incidents are not easily accessible. The only place that I found the list was using API call.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to setup an integration instance for Core REST API&lt;/P&gt;
&lt;P data-unlink="true"&gt;The URL will be POST https://hostname:443/investigations/search&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the body of the request, you will need this JSON&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"filter"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"andOp"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"id"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"#","#","#",&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;The response will include &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"entryUsers" key that contains a list of users that is associated to the incident.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;You can do all of this in one automation, and use this list of users to send out emails.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Jan 2024 17:03:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/572881#M2992</guid>
      <dc:creator>yuki_sato</dc:creator>
      <dc:date>2024-01-12T17:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Automation to query incident team from current and linked incidents</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/573069#M2994</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/263375"&gt;@yuki_sato&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thank you for the idea to utilize the API.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my solution to use in an automation in case anyone encounters a similar issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import json

INVESTIGATION_IDS = ["1234","2345"]

api_result = demisto.executeCommand("core-api-post", {"uri":"/investigations/search", "body":"{\"filter\":{\"andOp\":true,\"id\":"+json.dumps(INVESTIGATION_IDS) +"}}"})

users = set()

for investigation in api_result[0]['Contents']['response']['data']:
    print(investigation)
    for user in demisto.get(investigation, "users"):
        users.add(user)
demisto.results(users)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 13:51:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/automation-to-query-incident-team-from-current-and-linked/m-p/573069#M2994</guid>
      <dc:creator>Martin_Wiethan</dc:creator>
      <dc:date>2024-01-15T13:51:23Z</dc:date>
    </item>
  </channel>
</rss>

