<?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: Using current container info in a custom function in Splunk SOAR</title>
    <link>https://community.splunk.com/t5/Splunk-SOAR/Using-current-container-info-in-a-custom-function/m-p/532218#M516</link>
    <description>&lt;P&gt;Howdy!&lt;/P&gt;&lt;P&gt;You'll need to pass in container as a parameter to your function. Here is an example of what I believe you are trying to do:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sam_splunk_0-1607361221206.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12205i974594D40D5204E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sam_splunk_0-1607361221206.png" alt="sam_splunk_0-1607361221206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice I have a parameter to the custom function called 'container'. I pass that in like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sam_splunk_1-1607361268959.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12206i8839D2107549BBC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sam_splunk_1-1607361268959.png" alt="sam_splunk_1-1607361268959.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the container available in the CF, you can use collect2 as expected. Interestingly, notice line 17 on the first screenshot. We have to do "container=container[0]" because the Container parameter of collect2 expects a dict but the data comes in as a list, so we have to extract the dict from the list's first element.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Dec 2020 17:15:43 GMT</pubDate>
    <dc:creator>sam_splunk</dc:creator>
    <dc:date>2020-12-07T17:15:43Z</dc:date>
    <item>
      <title>Using current container info in a custom function</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Using-current-container-info-in-a-custom-function/m-p/532060#M515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Within a Custom Function, is it possible to grab information from the current container? For example, I've added this line to a function:&lt;/P&gt;&lt;P&gt;from_address = str(phantom.collect2(container=container, datapath=["artifact:*.cef.fromEmail"], limit=1)[0][0])&lt;/P&gt;&lt;P&gt;Ideally the value of the variable would just be a string of an email address. But I get an error that the variable "container" hasn't been defined.&lt;/P&gt;&lt;P&gt;However, when I test this line in the "custom code" section of a function block within a playbook, it works fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on how I can achieve this? Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 17:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Using-current-container-info-in-a-custom-function/m-p/532060#M515</guid>
      <dc:creator>s2233</dc:creator>
      <dc:date>2020-12-04T17:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using current container info in a custom function</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Using-current-container-info-in-a-custom-function/m-p/532218#M516</link>
      <description>&lt;P&gt;Howdy!&lt;/P&gt;&lt;P&gt;You'll need to pass in container as a parameter to your function. Here is an example of what I believe you are trying to do:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sam_splunk_0-1607361221206.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12205i974594D40D5204E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sam_splunk_0-1607361221206.png" alt="sam_splunk_0-1607361221206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice I have a parameter to the custom function called 'container'. I pass that in like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sam_splunk_1-1607361268959.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12206i8839D2107549BBC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sam_splunk_1-1607361268959.png" alt="sam_splunk_1-1607361268959.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the container available in the CF, you can use collect2 as expected. Interestingly, notice line 17 on the first screenshot. We have to do "container=container[0]" because the Container parameter of collect2 expects a dict but the data comes in as a list, so we have to extract the dict from the list's first element.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 17:15:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Using-current-container-info-in-a-custom-function/m-p/532218#M516</guid>
      <dc:creator>sam_splunk</dc:creator>
      <dc:date>2020-12-07T17:15:43Z</dc:date>
    </item>
  </channel>
</rss>

