Can I link issues with Automation for JIRA when I create a new issue?

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2016

What would I write in the Advanced section if I wanted to create links? 

For example: 

When issue X has a certain update, create issue Y and link them. 

Issue X relates to Issue Y.

thanks!

7 answers

1 accepted

1 vote
Answer accepted
andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2016

So there's two ways to achieve this.  The easiest way is to simply add the "Linked issues" field to your create issue action like this and link to the 'Trigger issue':

link-created.png

This requires that the linked issues field is on your create issue screen though!

 

You can also achieve this with the separate 'Link issue' action but it requires branching off (using the 'Branch rule / Related issues action') for the created issue:

link-related-created.png

One caveat with this approach is that if this is a project specific rule (which you can see in 'Rule details') and the created issue is another project then this wont work.  You'll have to change this rule to a 'Global' rule via the 'Automation rules' section in global admin first so that the 'related issues' branch action can find the created issue in a different project.

Find out more about Automation for JIRA on marketplace, or visit our component docs: http://codebarrel.io/available-rule-components

Phyllis Zhu September 14, 2016

I tried this but am getting an error in the automation log.

 

  Error creating issue
No issue link type with name 'relates to' found.

 

The type of link I want to do is "relates to" and linking is available on the create issue screen. I made a minor change to the code to reflect that:

{"update": {
        "issuelinks": [                   
            {
                "add": {
                    "type": {
                        "name""relates to"
                    },
                    "outwardIssue": {
                        "key""{{issue.key}}"
                    }
                }
            }
        ]
    }
}

 

 

Screen Shot 2016-09-14 at 8.59.31 AM.png

 

 

TIA!

Phyllis Zhu September 14, 2016

I figured it out, after some coffee and chocolate smile

Our issue link type is called Related.

 

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2016

Hi Phyllis, 

Glad to hear you worked it out. Many things are solved with coffee and chocolate (only dark chocolate though I hope smile)!

Yes I should have made that more clear in my answer.  To get the issue link name, you need to check what they are called in your instance by visiting https://<yourinstance>/secure/admin/ViewLinkTypes!default.jspa (if you are a global admin).

Cheers,
  Andreas 

Like Maksym Ivanchenko likes this
饶青 June 19, 2019

Hello Andreas,

I am very sorry,  I am not familiar with the configuration of Jira. How should I configure it to let the linked issues field on my create issue screen?

 

Sincerely

Qing

1 vote
Anoop Chatterjee April 21, 2017

You should add this little statement from the blog to all your documentation: 

Just make sure the “Link issues” field is on the appropriate screen in JIRA!

This was causing me havoc till I finally found this.

bpayer April 26, 2017

I have the "linked issues" field in the Create issues screen.  I have a rule set up to trigger once a story is created in a specific project to a specific Scrum Team....then Create a task...then link the task to the trigger issue.  Everything works up to the creation of the new task...but the new task will not link to the parent.

Basically once a story is created under specified conditions

new task is generated

and a link "Child of" is set to Trigger issue.

 

This doesn't seem to work.  Any suggestions??

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2017

Hey Brett,

Can you raise a support request please at https://codebarrel.io/support and include screenshots of your rule configuration and audit log (with show more expanded) please?

Cheers,

  Andreas

 

Marcos Sciarra January 10, 2019

Andreas,

I would like to use “Automation for JIRA” with the following behaviour:

“Link any issue if it is mentioned on a comment of any other issue” (using a particular type of relationship).

It is possible?

Kind regards,

 

Marcos

Like Brad Mace [ATS] likes this
0 votes
Mohammed Batarfi February 18, 2020

Hello,

 

I'm new to Jira and I have created set of rules to add a comment to the Service Desk ticket once we transition one of the software tickets. My problem is that I want to add the software ticket name into the comment. Is there a way to automate that in Jira?

mustafa korkmaz June 20, 2020

Hey Mohammed,

 

what you meant with " software ticket name"? Summary or what?

0 votes
PhilSpo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2019

Hello,

 

I can successfully create and link the new issue, but im having some trouble pulling across some of our custom fields that contain insight objects.

 

Capture.PNG

When I check the new issue created, the data doesn't exist. I can edit the issue and then add them all in manually but it doesnt seem the copy works.

 

Thanks

 

Phil

0 votes
Zach Stahl January 12, 2018

Hi, I think I have a similar problem. When an Issue's status is changed to Done I use Automation to Clone the Issue and transition it to Backlog. However I need all the Sub-Tasks of the Issue to also be cloned and transitioned to Backlog. How would you set up this rule?

 

Clone Issue > Transition to Backlog > Branch: Subtasks > Link Issue??

 

So far I keep ending up with two clones of the parent issue in Backlog of trigger issue and no sub-tasks.

0 votes
Pompi Diplan August 28, 2017

the rule in the picture produces, for a non-null triggerIssue and a non-empty Driver (user picker) the following description:

RulareTeste pt: 
TESTS IN PROGRESS status instrumentat de un child- (=belongs-to) task in Daily. 
and triggerissue is

and triggerissue.fields.driver e:

triggerIssue info needed.JPG

 

Any help is appreciated, thanks!

Pompi

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2017

Hi Pompi,


Looking at your screenshot, it looks like you are using 'triggerissue'.  This is case sensitive though. It needs to be:

triggerIssue

Hope that helps.  Also to set a user field like 'Tester', you'll need:

{{triggerIssue.fields.Tester.name}}

 

Cheers,

  Andreas

Like Dan Bish likes this
Arici Destept August 29, 2017

That workded like a charm. Thank you. (it would be nice to have it emphasized that curly language , at least as variable names goes, is in fact case sensitive. I was under the impression , after reading the couple doc pages, taht smart fields are case insensitive - could be just my lack of attention though). Thanks again for the prompt response.

0 votes
Arici Destept August 28, 2017

Hi Andreas,.

Is there a guarantee that the trigger issue is available in scope via smart values, e.g., {{triggerIssue.fields.MyCustomTextField}}? I am having troubles squeezing any sort of info from the issue triggering the rule once I find myself deep down covered under a branch rule like "For all linked issues". The values there, for both {{triggerIssue}} and {{triggerIssue.fields.MyCustomTextField}} are null (empty string if tried to be dereferenced in, say, Description or Assignee box). 

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2017

Hi Arici,

 

That should definitely work. 'triggerIssue' is always defined to be the issue introduced by the rule trigger.

Can you raise a support request please at: https://codebarrel.io/support

Please include a screenshot of your rule configuration and audit log showing a rule execution.

Cheers,

  Andreas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events