<?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 create table show incident close reason group by incident type in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/445697#M425</link>
    <description>&lt;P&gt;I am new to XSOAR and&amp;nbsp;I am trying to create table show incident close reason group by incident type looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE width="332"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="96"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="85"&gt;Ture positive&lt;/TD&gt;&lt;TD width="87"&gt;False positive&lt;/TD&gt;&lt;TD width="64"&gt;Duplicate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I cant find any widget can do this so I try to look into the automation script but I have no idea how it going to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can give a hit on this would be great?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition, does anyone can share some good starting tutorial relate with automation scripting would be appricated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2021 05:51:35 GMT</pubDate>
    <dc:creator>LinsongGuo</dc:creator>
    <dc:date>2021-11-05T05:51:35Z</dc:date>
    <item>
      <title>create table show incident close reason group by incident type</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/445697#M425</link>
      <description>&lt;P&gt;I am new to XSOAR and&amp;nbsp;I am trying to create table show incident close reason group by incident type looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE width="332"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="96"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="85"&gt;Ture positive&lt;/TD&gt;&lt;TD width="87"&gt;False positive&lt;/TD&gt;&lt;TD width="64"&gt;Duplicate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;incident type 3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I cant find any widget can do this so I try to look into the automation script but I have no idea how it going to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can give a hit on this would be great?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition, does anyone can share some good starting tutorial relate with automation scripting would be appricated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 05:51:35 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/445697#M425</guid>
      <dc:creator>LinsongGuo</dc:creator>
      <dc:date>2021-11-05T05:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: create table show incident close reason group by incident type</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/446449#M426</link>
      <description>&lt;P&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/198665"&gt;@LinsongGuo&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;In order to get better traction for this, I have moved your query to the Cortex XSOAR area.&lt;/SPAN&gt;&lt;BR style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" /&gt;&lt;SPAN style="color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;I would recommend that you visit this area to see your discussion and others on Cortex XSOAR.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers !&lt;/P&gt;
&lt;P&gt;-Kiwi.&lt;/P&gt;
&lt;DIV id="ConnectiveDocSignExtentionInstalled" data-extension-version="1.0.4"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Nov 2021 13:06:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/446449#M426</guid>
      <dc:creator>kiwi</dc:creator>
      <dc:date>2021-11-09T13:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: create table show incident close reason group by incident type</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/446494#M429</link>
      <description>&lt;P&gt;Take a look at the automation script widgets here:&amp;nbsp;&lt;A href="https://docs.paloaltonetworks.com/cortex/cortex-xsoar/6-2/cortex-xsoar-admin/widgets/create-a-custom-widget-using-an-automation-script/widget-type-examples-using-automation-scripts.html" target="_blank"&gt;https://docs.paloaltonetworks.com/cortex/cortex-xsoar/6-2/cortex-xsoar-admin/widgets/create-a-custom-widget-using-an-automation-script/widget-type-examples-using-automation-scripts.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an example for you use case (and assuming you have fields called "True Positive" and "False Positive" that are boolean (bear in mind this is pseudo code and not tested):&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;page = 0
size = 100

table_results = dict()

data = demisto.executeCommand("getIncidents", {"page": page, "size": size})[0]['Contents']

while data.get('data'):
    for incident in data.get('data'):
        inc_type = incident.get('type')
        custom_fields = incident.get('CustomFields')
        if inc_type not in table_results:
            table_results[inc_type] = {
                "True Positive": int(custom_fields.get('truepositive')) or 0,
                "False Positive": int(custom_fields.get('falsepositive')) or 0,
                "Duplicate": custom_fields.get('dropppedcount') or 0,
            }
        else:
            if custom_fields.get('truepositive'):
                table_results[inc_type]['True Positive'] += 1
            if custom_fields.get('falsepositive'):
                table_results[inc_type]['False Positive'] += 1
            table_results[inc_type]['Duplicate'] += incident.get('droppedcount')
    page += 1
    data = demisto.executeCommand("getIncidents", {"page": page, "size": size})[0]['Contents']

return_results = [{
    "Type": k,
    "True Positive": v.get('True Positive'),
    "False Positive": v.get('False Positive'),
    "Duplicate": v.get('Duplicate')
    } for k, v in table_results.items()]
    

return_results(return_results)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 15:16:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/create-table-show-incident-close-reason-group-by-incident-type/m-p/446494#M429</guid>
      <dc:creator>ABurt</dc:creator>
      <dc:date>2021-11-09T15:16:23Z</dc:date>
    </item>
  </channel>
</rss>

