Automation to add label when linked issue is in a certain project
Asked by Jack Crowe:

I'm trying to get a label to be applied when an issue from a certain project is linked to an issue in another certain project:  
![Screenshot 2024-07-19 at 13-48-37 Audit log - Automation - Technical Support - Jira.png](/t5/image/serverpage/image-id/336784iE5F7B969D70AF2F9/image-size/large?v=v2&px=999 "Screenshot 2024-07-19 at 13-48-37 Audit log - Automation - Technical Support - Jira.png")

I added the Branch condition, but if I go and create an issue link, it doesn't seem to show up in the audit log! I can see some changes are triggering it but still not applying the label.  

What am I missing here?


Answers:
author: Trudy Claspill
body: Hello [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649)

I wrote a long winded explanation about how using the Issue Linked trigger is different from other triggers, but then I refreshed my screen and lost it.

So I'll condense it to say that with that specific trigger, the issue that triggers the rule is not necessarily the one from which you create the link. The rule may end up being triggered by the issue to which you linked.

If you want a more detailed explanation of that, let me know.

You will need to create the rule as a multiple-project scoped rule, specifying the two projects of interest.

In your rule you have specified all link types, so the rule may be triggered by the issue in either project. So, you will have to add some conditions to check the Project of the triggering issue, and the Project of the other issue in the linkage. I haven't quite worked out all the details for that yet.

Is it correct that you would not want the label applied if the link was created between two issues in the same project?

In which of the issues do you want to add the label? Would it always be in the Project A issue, or the Project B issue, or in both?

comments: author: Trudy Claspill
body: I've worked out the checking of the Project to which the issues belong. The last things I need are the answers to my two questions. Then I can provide a sample rule.


author: Jack Crowe
body: Correct - I do not want the label applied if the link was between two issues in the same project.

<br />

I would only want issues in the Tech Support project to get the label - so it doesn't matter the relationship or relationship directions.


author: Trudy Claspill
body: Hello [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649)

I apologize that I haven't gotten back to you sooner.

Here is a rule that works. In my example "ATK" is the project where I want the label added to the issue, and "CS" is the other project in the link pairing.

![Screenshot 2024-08-04 at 5.48.08?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339905iCEFE57329EAF5899/image-size/large?v=v2&px=999 "Screenshot 2024-08-04 at 5.48.08?PM.png")

The "IF" is an "IF-ELSE Condition"

![Screenshot 2024-08-04 at 5.49.36?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339906i8D28B1AB82D928D5/image-size/large?v=v2&px=999 "Screenshot 2024-08-04 at 5.49.36?PM.png")![Screenshot 2024-08-04 at 5.49.52?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339907i3FD52D936C8D4481/image-size/large?v=v2&px=999 "Screenshot 2024-08-04 at 5.49.52?PM.png")

The Edit Issue Fields action looks like this:

![Screenshot 2024-08-04 at 5.50.49?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339908i716F30DA83706F5E/image-size/large?v=v2&px=999 "Screenshot 2024-08-04 at 5.50.49?PM.png")

If you want more explanation on any of these steps, let me know.


author: Trudy Claspill
body: Hello [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649)

Did my response help you achieve your requirement? If so, please consider clicking on the Accept Answer button to mark your question as Solved.

If you still have additional questions or this is not working for you, please let me know.


author: Jack Crowe
body: I got some reports from colleagues and ended up with this logic, which I hear is working.. correctly.  

Thanks [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) for the input, your answer seems better and I will use it if I come back to edit it!  

Here's my version for posterity:  
![Screenshot 2024-08-26 at 08-44-59 Rule builder - Automation - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/343869iF63257CA41DCF743/image-size/large?v=v2&px=999 "Screenshot 2024-08-26 at 08-44-59 Rule builder - Automation - Jira.png")


author: Luis Felipe Studzinski Santos
body: [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649)Hello,  
See this possibility. The first edit is for the issue that is in the link and the second edit is for the issue that received the link.

Also, the automation must be of Global scope.![Screenshot_5.png](https://community.atlassian.com/t5/image/serverpage/image-id/336796i612AA89E8AD9966D/image-size/large?v=v2&px=999 "Screenshot_5.png")

![Screenshot_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/336790i59801E043A7FCE5F/image-size/large?v=v2&px=999 "Screenshot_1.png")

Also, the automation must be of Global scope

comments: author: Luis Felipe Studzinski Santos
body: ![Screenshot_4.png](https://community.atlassian.com/t5/image/serverpage/image-id/336793i36E5764A5C2C958A/image-size/large?v=v2&px=999 "Screenshot_4.png")![Screenshot_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/336791i85E21B1D4D12E928/image-size/large?v=v2&px=999 "Screenshot_2.png")


author: Trudy Claspill
body: [@Luis Felipe Studzinski Santos](/t5/user/viewprofilepage/user-id/5356722)

I don't think your solution matches the author's requirement:
> when an issue from a certain project is linked to an issue in another certain project


author: Tim Kopperud
body: Hi [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649), if I understand you correctly you can apply something shown in the example below. Notice two things:

1. You will need to apply the rule scope accordingly to your requirements.
2. You must handle linking automation from *both sides* (hense bullet #1 above):
   1. The linking is done while "standing" in the project where you need to set the label.
   2. The linking is done while "standing" any other projects.

In my example I will label the issues on project **MOBL** , and only if the other project is **FAC**. But you can add as many projects as needed, or make i global (all projects).

Regarding bullet #1 {#toc-hId--351642668}
-----------------------------------------

The image below shows the rule details dialog from the MOBL automation view.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/336812i28C1B3CC7EA27CC2/image-dimensions/293x143?v=v2 "image.png")

The image below shows the *same rule* details but from the Global administration view.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/336814iCA05FBCC19F4E67A/image-dimensions/286x143?v=v2 "image.png")

In the Scope dropdown you select according to your requirements, and if not using Global scope add the wanted projects (ref yellow marking).

The rule {#toc-hId-2135870165}
------------------------------

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/336815i570438B8E5D493D4/image-size/large?v=v2&px=999 "image.png")

This rule triggers when linking is done in any projects within the rule scope.

The main thread will handle linking done from "the project", ref bullet #2.1

The branch will handle any linking done when from "other projects", ref bullet #2.2.

The filters applied make sure labels are only set on the MOBL project. E.g. if global scope you will add labels "everywhere" when a linking occurs if fileter is not applied as shown above.

TimK

comments: author: Jack Crowe
body: Thank you Tim! I tried this and it seemed to work on more cases but now it seems to be failing.  

I'm going to see if the person above has any other ideas and will report back.


author: Tim Kopperud
body: Hi [@Jack Crowe](/t5/user/viewprofilepage/user-id/3273649), if you share some details on what started to fail after it worked I might be able to help further.

TimK


Tags: cloud

jira-cloud