<?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: demisto-py - Specify Playbook in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438820#M384</link>
    <description>&lt;P&gt;Thank you for taking the time to reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the relevant part (the script is fairly long and involved, and the rest doesn't come into play) :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    # Create ticket request object
    oTicket = demisto_client.demisto_api.CreateIncidentRequest()

    # Write common case data
    oTicket.name = sCaseNum.split(' ')[0]
    for k, v in dBase.items() :
        setattr(oTicket, k, v)

    # Write the custom fields to the case
    setattr(oTicket, 'custom_fields', dCustom)

    try :
        # Create the incident
        api_response = oAPI.create_incident(create_incident_request=oTicket)
        # Parse the returned data
        iCreatedId = api_response.to_dict().get('id')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prior to this, the script gathers all relevant data, either through an input Word document or by prompting the user.&amp;nbsp; The data has been split into two Python dictionaries - one for the base fields and one for the custom_fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once this function has the data, it attaches it to the case (oTicket) via setattr.&amp;nbsp; It then creates the case and saves the case number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No other fields have issues, so I think the coding is solid.&amp;nbsp; It is just this one - I get conflicting hints on whether it should be playbookid or playbook_id.&lt;BR /&gt;&lt;BR /&gt;I'm at a loss, but need to figure this out because I want to be able to arbitrarily run playbooks when this script runs.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 13:36:22 GMT</pubDate>
    <dc:creator>twjolson</dc:creator>
    <dc:date>2021-10-05T13:36:22Z</dc:date>
    <item>
      <title>demisto-py - Specify Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438434#M370</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a python script using demisto-py that creates tickets based on an input Word document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, specifying the playbook isn't working.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I call demisto_client.demisto_api.CreateIncidentRequest() with the "playbookid" field is populated with the Playbook name, as found in Playbooks page.&amp;nbsp; &amp;nbsp;I thought this field invoked the playbook in older versions of my script, but I may be incorrect.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I create the incident via create_incident(),&amp;nbsp; "playbookid" isn't present, but "playbook_id" is, and it is empty.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;The case is created fine, but in the context data, "playbookid" is an empty string.&amp;nbsp; "playbook_id" is not present.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Changing the field name to "playbook_id" I get a "Item not found" error and the case isn't created.&amp;nbsp; You'd think playbook_id is the field to use as that is the field used by default and is listed in one of the examples on github.&amp;nbsp; But, I've never gotten it to work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&amp;nbsp; Am I missing something?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 14:03:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438434#M370</guid>
      <dc:creator>twjolson</dc:creator>
      <dc:date>2021-10-04T14:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: demisto-py - Specify Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438728#M380</link>
      <description>&lt;P&gt;Can you share the script you are using? There are 2 invocations of create incident. One using a single incident creation with specific fields and the other using JSON.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 08:10:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438728#M380</guid>
      <dc:creator>ABurt</dc:creator>
      <dc:date>2021-10-05T08:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: demisto-py - Specify Playbook</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438820#M384</link>
      <description>&lt;P&gt;Thank you for taking the time to reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the relevant part (the script is fairly long and involved, and the rest doesn't come into play) :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    # Create ticket request object
    oTicket = demisto_client.demisto_api.CreateIncidentRequest()

    # Write common case data
    oTicket.name = sCaseNum.split(' ')[0]
    for k, v in dBase.items() :
        setattr(oTicket, k, v)

    # Write the custom fields to the case
    setattr(oTicket, 'custom_fields', dCustom)

    try :
        # Create the incident
        api_response = oAPI.create_incident(create_incident_request=oTicket)
        # Parse the returned data
        iCreatedId = api_response.to_dict().get('id')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prior to this, the script gathers all relevant data, either through an input Word document or by prompting the user.&amp;nbsp; The data has been split into two Python dictionaries - one for the base fields and one for the custom_fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once this function has the data, it attaches it to the case (oTicket) via setattr.&amp;nbsp; It then creates the case and saves the case number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No other fields have issues, so I think the coding is solid.&amp;nbsp; It is just this one - I get conflicting hints on whether it should be playbookid or playbook_id.&lt;BR /&gt;&lt;BR /&gt;I'm at a loss, but need to figure this out because I want to be able to arbitrarily run playbooks when this script runs.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 13:36:22 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/demisto-py-specify-playbook/m-p/438820#M384</guid>
      <dc:creator>twjolson</dc:creator>
      <dc:date>2021-10-05T13:36:22Z</dc:date>
    </item>
  </channel>
</rss>

