Auto link issues with same field value
Asked by Prathap DL:

Hi Community.

i have Single line text custom Field(For Serial number) in "Project A" "issue type A" When ticket is creating user will enter Value to custom Field and creates ticket.

In "Project B" "issue type B" i have one multi line text custom Field Where user will enter Single or Multiple Serial number which is already created in "Project A"

Here My question is Whenever Serial number is entered in Project B issue type B ticket, Automatically it should link with Project A issue type A ticket. If User enter 3 Serial number in project B then All 3 tickets from Project A should auto link with Project B ticket.


Answers:
author: Bibek Behera
body: [@Prathap DL](/t5/user/viewprofilepage/user-id/5541334) ,

Looks doable, If my assumptions are correct. However, you might end up having too many links.

Things to do:

Try creating a filter on Project A with the field value you want to filter.

Use the same filter in automation for the list on issues.

Monitor for the field value change, and set the Link using the outcome of the JQL match.

-Bibek

comments: author: Prathap DL
body: Hi [@Bibek Behera](/t5/user/viewprofilepage/user-id/510396)

Thanks for the Reply. I'm new to this Jira and Automation Rule. So could you please provide the More Details or Automation Rule which can i use as reference.

Thanks


author: Oday Rafeh
body: Hi [@Prathap DL](/t5/user/viewprofilepage/user-id/5541334) ,

Welcome to the Community

You can do that with Automation Rules,

* Go to **Project Settings \> Automation** , create a new rule with the trigger **Issue Created**, add a condition to check if the issue is of type B in Project B, and use a branch rule to iterate over the serial numbers entered.

comments: author: Prathap DL
body: Hi [@Oday Rafeh](/t5/user/viewprofilepage/user-id/5172837)

Thanks for the Reply. I'm new to this Jira and Automation Rule. So could you please provide the More Details or Automation Rule which can i use as reference.

Thanks,


author: Oday Rafeh
body: Hi [@Prathap DL](/t5/user/viewprofilepage/user-id/5541334) ,

I will try to make it simple :

To automatically link issues based on serial numbers, follow these steps in Jira:

1. Go to **Project Settings** \> **Automation**.
2. Create a new rule with the trigger **Issue Created**.
3. Add a condition to check if the issue is of t**ype B** in **Project B.**
4. Use a **branch rule** to iterate over the serial numbers entered.
5. Add a **JQL condition** to find matching issues in **Project A** :  

       project = "Project A" AND issuetype = "issue type A" AND "Serial Number" ~ "{{field}}"

6. Link the found issues to the current issue.

I hope this will help you if this doesn't help let me know and I will create screenshots for you on how to do it.


author: Bill Sheboy
body: Greetings,

Project-scope rules may create or clone issues in other projects, but cannot access them otherwise.

Rules which access (or update) issues in multiple projects must have global or multiple-project scope. Such rules are defined in the global automation area, not in the project settings. Your Jira site admin will need to configure such a rule.

Kind regards,  
Bill


author: Prathap DL
body: [@Oday Rafeh](/t5/user/viewprofilepage/user-id/5172837)

I tried above steps which you given but I'm not able to use {{field}} in JQL. instead i tried Serial number field is not Empty.

Now all the tickets in project A which has serial numbers all linking to Project B single ticket.

I used below rule

I want Project B custom field value to match with Project A custom field value. then only it should link with each other.

Note: Project B custom field name and project A custom Field name is different.

And Project B field can have multiple Serial numbers in it. in that case all the tickets related project A should link with Single ticket in Project B

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/337506i6CD48CC063AA0695/image-dimensions/411x427?v=v2 "image.png")


author: Oday Rafeh
body: [@Prathap DL](/t5/user/viewprofilepage/user-id/5541334) Hi again

try to write you JQL like this :

```
project = "Project A" AND issuetype = "Issue Type A" AND "Serial Number" ~ "{{customfield_xxxxx}}"
```

this JQl should find issues in Project A that match the serial numbers entered in Project B.


author: Prathap DL
body: Hi [@Oday Rafeh](/t5/user/viewprofilepage/user-id/5172837)

I tried above JQL and getting Error. Please find the Rule screenshot and Audit Log

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/337581i46FDBCB681C73980/image-dimensions/380x404?v=v2 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/337582i67A9D4DD0100D5D6/image-size/large?v=v2&px=999 "image.png")


author: Oday Rafeh
body: For you JQL this what you need to adjust to work with custom field smart value :

```
{{issue.customfield_xxxxx}}?
```


author: Prathap DL
body: Hi [@Oday Rafeh](/t5/user/viewprofilepage/user-id/5172837)

I tried this also but same error.


Tags: cloud

jira-cloud