Creating an issue and linking to parent issue with Scriptrunner Jira Cloud

Hi,

I just need to define the link to the parent issue when the child gets created and I can't find any example of how to do this.

def taskType = get('/rest/api/2/issuetype').asObject(List).body.find { it['name'] == 'Warranty Claim Robot Component' }['id']
post('/rest/api/2/issue')
        .header('Content-Type', 'application/json')
        .body(
        [
                fields: [
                            summary    : 'Test Ignore this',
                            description: "Test Ignore this",
                            project    : [
                                    key: projectNewIssueKey
                            ],
                            issuetype  : [
                                    id: taskType
                            ],
                  			
							//Need to define issue links here?
                            
                        ]
        ])
        .asString().body

I've found a rest example of this but I am unsure of how to convert it to scriptrunner/groovy syntax.

https://docs.atlassian.com/jira/REST/cloud/#api/2/issueLink-linkIssues

Any help would be much appreciated. 

 

Kind regards

Thomas P. Hargreaves

 

1 answer

1 accepted

Hi Thomas,

We've put an example of how to do issue linking in our documentation: http://scriptrunner-docs.connect.adaptavist.com/jiracloud/post-functions.html#_link_to_an_issue

The link has to be created after the issue is created, they can't be done in one request.

I hope that helps,

Jon

Hi Jon,

Fantastic, thank you very much.

 

Kind regards,

Thomas P. Hargreaves

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

883 views 5 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot