Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner Jira Cloud - Adding links based on labels

Kimmy Roberts March 31, 2018

I am using Jira Cloud and ScriptRunner.

I have created my own links called "Parent of" and "Child of".

Our structure we use is Story > Task > Subtask. The stories are connected to the tasks by these custom links.

When a story is created it is given a label that mirrors the name of the story. The tasks are also given this same label.

I would like to write a script that does the following:

  • If the label is on a story, it is given the "Parent of" custom link automatically
  • If the label is on a task, it is given the "Child of" custom link automatically

That way, if the label is put on the story on creation and then added to a task, the "Parent of" and "Child of" links are automatically added.

1 answer

1 accepted

0 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
April 11, 2018

Hi Kimmy,

In order to do this you should look at using a script listener configured to run on the issue created and issue updated events.

The script listener should then look to get the fields for the issue and check the labels on the issue using  the rest API outlined here.

If the label is found then you should look to add the issue links using the rest API outlined here.

You may find the example in the documentation here useful to help you getting started with the fields from the issue.

Thanks

Kristian

Suggest an answer

Log in or Sign up to answer