Creating an issue in github and I want it to be put as part of a userstory within a jira-project

Originally asked by George Smith on 06 May 2022 (original question)


Considering the following usecase: I am creating an issue in github and I want it to be put as part of a userstory within a jira-project. How to accomplish that?

I can manage to let a new issue being made in Jira, but to make it part of a certain story seems impossible for now. For example in the incoming sync I set issue.parentId() , but it gives me an error “While trying to create an issue of type ‘Task’ in project ‘SB’ for remote ‘15’, Jira responded with: ; Field Given parent issue does not belong to appropriate hierarchy: parentId…”.


Answer by Syed Majid Hassan on 09 May 2022

Hi George,

I believe you are looking to create sub-tasks within a user story for all the issue synced over from Github. I have achieved this using the following method:

  1. Get the ID of the user story in Jira using Rest API.
  2. Add the following in the Jira Incoming script:
if(firstSync){
   issue.projectKey   = "CM" 
   issue.typeName     = "Sub-task" 
   issue.parentId = 10236//localParent.id
}

This will ensure that any issues coming over from GitHub are created as sub-tasks in Jira under the story 10236.

Please find a short video recording demonstrating the solution.

Thanks

Majid


Comments:

Syed Majid Hassan commented on 09 May 2022

Attached again.

GH JC sync sub-task.mp4 (old community)

Ap commented on 09 May 2022

Works like a charm. Thanks for figuring out!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.