IBM QRadar SOAR

IBM QRadar SOAR

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Jira integration - creating subtasks.

    Posted Mon March 28, 2022 03:48 AM
    Hello everyone,

    Using Jira integration App, I am able to create an issue(of Type task), based on an action on resilient task.
    I need to be able to create a sub task, whether under existing task on jira, or Create new task with its associated subtasks.

    I tried to send a request similar to below, in the preprocessing script, but it failed, I formatted it into the dic inside the "inputs.jira field", where parent is the current exisiting task, and I am selecting jira issue type as "Sub-task" as per the jira type name.
    but "parent" object was not recognized, I added parent to the client.py of that integration, on the create issue function as per below, but still getting errors for the "parent" like below.

    Error msg.

    Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/fn_jira/components/jira_open_issue.py", line 63, in _jira_open_issue_function jira_issue = jira_client.create_issue(fields=jira_fields) File "/usr/local/lib/python2.7/site-packages/jira/client.py", line 1102, in create_issue p = data['fields']['parent'] KeyError: u'parent'
    Creating JIRA issue
    Connecting to JIRA
     

    client.py edits.
    p = data['fields']['parent']
    if isinstance(p, string_types) or isinstance(p, integer_types):
    data['fields']['parent'] = {'id': self.parent(p).id}
     

    Example from Jira APIs to create sub task.

    {
    "fields":
    {
    "project":
    {
    "key": "TEST"
    },
    "parent":
    {
    "key": "TEST-101"
    },
    "summary": "Sub-task of TEST-101",
    "description": "Don't forget to do this too.",
    "issuetype":
    {
    "id": "5"
    }
    }
    }

    I am not sure if I need to define that parent object in the resources.py as well or any other py file with this integration, or It is something else?

    Appreciate your support.

    ------------------------------
    ahmed abushanab
    ------------------------------


  • 2.  RE: Jira integration - creating subtasks.

    Posted Tue March 29, 2022 08:33 AM
    You mentioned that you:

    I tried to send a request similar to below, in the preprocessing script, but it failed,

    What was the error?
    Is your goal to use the data from a workflow/playbook?

    Ben

    ------------------------------
    Ben Lurie
    ------------------------------



  • 3.  RE: Jira integration - creating subtasks.
    Best Answer

    Posted Tue March 29, 2022 10:57 AM
    Hi Ahmed!

    I think I might have a solution to your issue. In my Jira setup, "subtask" was not ID 5. Instead, I used the "name" of the subtask issue type. The following values worked for me (the parent issue was a "Story" and I had to make sure that I had enabled subtasks as a type in the Jira UI; I also had noticed that the name was "Subtask" with no "-" in my Jira UI):
    inputs.jira_fields = dict_to_json_str({
    "project": "TEST",
    "parent": {'key': incident.properties.jira_issue_id}, # In my example, this was "TEST-1"
    "issuetype": "Subtask",
    ...
    })
    ​There should be no need to modify the jira client.py code. That is provided by Jira, not by IBM's fn_jira app. Simply adjusting the inputs in the pre-processing script for handling task's was enough for my app.

    I will note, however, that I was running all of this on Python 3.6. Is there a chance that this might be related to you running on Python 2.7? ​

    ------------------------------
    Bo Bleckel
    ------------------------------