<?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: Extracting fields from  Context/JSON in Playbook in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1223196#M3936</link>
    <description>&lt;P&gt;Hi Mohammad,&lt;BR /&gt;&lt;BR /&gt;You should be able to reference the list of task names with ${GetFailedTasks.Task Name}, and Task ID's with ${GetFailedTasks.Task ID} without the need for extend-context or ParseJSON, since the output should already be json-formatted - list of dictionaries.&amp;nbsp;&lt;BR /&gt;If those keys don't get you the data in the format you're looking for, I can help with determining further steps to transform it&lt;/P&gt;</description>
    <pubDate>Fri, 07 Mar 2025 21:24:32 GMT</pubDate>
    <dc:creator>cbrake1</dc:creator>
    <dc:date>2025-03-07T21:24:32Z</dc:date>
    <item>
      <title>Extracting fields from  Context/JSON in Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1222915#M3932</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to use the "GetFailedTasks" built-in automation to take some actions on the failed tasks and playbooks. The challenge i'm facing is parsing off fields from the output of the "GetFailedTasks" in playbook, namely "Task ID" and "Task Name" fields.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output is JSON dict, below is sample output of three failed tasks:&lt;/P&gt;
&lt;P&gt;[&lt;BR /&gt;{&lt;BR /&gt;"Command Name": "SetGridField",&lt;BR /&gt;"Brand Name": null,&lt;BR /&gt;"Incident Owner": "xxx@xx.com",&lt;BR /&gt;"Task Name": "updategrid-02",&lt;BR /&gt;"Command Description": "Creates a Grid table from items or key-value pairs.",&lt;BR /&gt;"Incident ID": "73773",&lt;BR /&gt;"Playbook Name": "xx-PB03-XSOAR-Monitor Playbook Failed Tasks.",&lt;BR /&gt;"Incident Created Date": "2025-02-25T12:05:58.490512072+01:00",&lt;BR /&gt;"Task ID": "5",&lt;BR /&gt;"Number of Errors": 18&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Command Name": "cisco-spark-create-message",&lt;BR /&gt;"Brand Name": null,&lt;BR /&gt;"Incident Owner": "",&lt;BR /&gt;"Task Name": "Send cisco webex message",&lt;BR /&gt;"Command Description": "Posts a plain text message, and optionally, a media content attachment, to a room.",&lt;BR /&gt;"Incident ID": "73921",&lt;BR /&gt;"Playbook Name": "FT - Darktrace Model Breaches (2025.01)",&lt;BR /&gt;"Incident Created Date": "2025-02-28T09:46:26.612020922+01:00",&lt;BR /&gt;"Task ID": "161",&lt;BR /&gt;"Number of Errors": 7&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"Command Name": "cisco-spark-create-message",&lt;BR /&gt;"Brand Name": null,&lt;BR /&gt;"Incident Owner": "",&lt;BR /&gt;"Task Name": "Send cisco webex message",&lt;BR /&gt;"Command Description": "Posts a plain text message, and optionally, a media content attachment, to a room.",&lt;BR /&gt;"Incident ID": "73923",&lt;BR /&gt;"Playbook Name": "FT - Darktrace Model Breaches (2025.01)",&lt;BR /&gt;"Incident Created Date": "2025-02-28T09:51:26.562991852+01:00",&lt;BR /&gt;"Task ID": "161",&lt;BR /&gt;"Number of Errors": 6&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What i did so far&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Created playbook, first task calls the automations script "GetFailedTasks" and extends context with value "failed_tasks" so that i use it in the second task&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_2-1741271992310.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66408i5DB782728514F9A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_2-1741271992310.png" alt="MMohammad12_2-1741271992310.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- The second task, i use parsejson function, and i invoke the failed_tasks with&amp;nbsp; ( .Task ID)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_1-1741271924391.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66407i7183BDD117805DC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_1-1741271924391.png" alt="MMohammad12_1-1741271924391.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output of the first task is&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_3-1741272140857.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66409i266A811762B66124/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_3-1741272140857.png" alt="MMohammad12_3-1741272140857.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the output of the second task is empty, it cannot extract the json field "Task ID"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_4-1741272234443.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66410i7B45D6949133DC09/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_4-1741272234443.png" alt="MMohammad12_4-1741272234443.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What went wrong here&lt;/P&gt;
&lt;P&gt;What is the best way to extract fields of json dict ( maybe nested)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:44:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1222915#M3932</guid>
      <dc:creator>MMohammad12</dc:creator>
      <dc:date>2025-03-06T14:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting fields from  Context/JSON in Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1223135#M3935</link>
      <description>&lt;P&gt;Hey, could you show the context data after the execution of those tasks? I suspect that the result from the 1st task is already a dictionary so no parsing is needed.&lt;/P&gt;
&lt;P&gt;If it isn't and you have something like " failed_tasks: 'json_value_as_string_here' ", I believe just simply doing &lt;STRONG&gt;!ParseJSON value=${failed_tasks}&lt;/STRONG&gt; should work.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 11:02:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1223135#M3935</guid>
      <dc:creator>ricardo.j.mateus</dc:creator>
      <dc:date>2025-03-07T11:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting fields from  Context/JSON in Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1223196#M3936</link>
      <description>&lt;P&gt;Hi Mohammad,&lt;BR /&gt;&lt;BR /&gt;You should be able to reference the list of task names with ${GetFailedTasks.Task Name}, and Task ID's with ${GetFailedTasks.Task ID} without the need for extend-context or ParseJSON, since the output should already be json-formatted - list of dictionaries.&amp;nbsp;&lt;BR /&gt;If those keys don't get you the data in the format you're looking for, I can help with determining further steps to transform it&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 21:24:32 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1223196#M3936</guid>
      <dc:creator>cbrake1</dc:creator>
      <dc:date>2025-03-07T21:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting fields from  Context/JSON in Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1224004#M3950</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/222437"&gt;@cbrake1&lt;/a&gt;&amp;nbsp;, thanks , that worked. However now i am running into another issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The goal here is to populate a grid in the incident layout with a set of data. The first set of data is successfully populated from the GetFailedTasks Context path.&lt;/P&gt;
&lt;P&gt;I want to add a field "playbook URL" to the grid. The field is parsed and transformed properly based on the previous post, so what i did:&lt;/P&gt;
&lt;P&gt;- i added a column (Playbook URL) to the Grid incident field config (see screenshot 1), for some reason this doesn't show up at all in the layout (screenshot 2). I even created a new grid but it didn't take the new column. Even when i open the layout config it doesn't recognize the field. Any conditions or restrictions to adding column to grid&amp;nbsp; ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_0-1742210911050.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66673iEB1C11A6A9F2B4F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_0-1742210911050.png" alt="MMohammad12_0-1742210911050.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MMohammad12_1-1742210962257.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/66674i8CE5FC98A4DFA9AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MMohammad12_1-1742210962257.png" alt="MMohammad12_1-1742210962257.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My plan is once i get that column added to the grid, i will invoke a second SetGridField task in the playbook to populate the new field, as every "setGridField" points to one ContextPath.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your help is appreciated !!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 11:29:55 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/extracting-fields-from-context-json-in-playbook/m-p/1224004#M3950</guid>
      <dc:creator>MMohammad12</dc:creator>
      <dc:date>2025-03-17T11:29:55Z</dc:date>
    </item>
  </channel>
</rss>

