Help linking issues across two projects that have the same value in a custom field
Asked by Brandon:

I am fairly experienced with automations when working in a single project, including creating a link between issues with a shared value. But now that I am trying to do this with issues in two separate projects I've found myself stumped and could use some help!

What I'm trying to do with this automation:

1. When a new issue is created in one project, look for issues in the other project that have the same value in the CBSA field
2. If any matches are found, create a "relates to" issue link

And these are the project/field details:

1. The project keys are REC and NSA
2. Both projects have a custom field named "CBSA"
3. In the first project (REC), the field is customfield_10178
4. In the second project (NSA), the field is customfield_10170

I have automations that perform the same function, but in a single project. These automations use the smart values condition to compare field values. But, in a single project, the custom field is has the same identifier (e.g., customfield_10178). I'm unsure of how to compare the CBSA field since the identifier is different in each of the projects.


Answers:
author: Kalyan Sattaluri
body: If you dont have scope to work with both projects, you could accomplish this with webhook/webrequest.

Imagine your requirements is that If an issue is created in Project REC with CBSA field populated, you need to find issues in Project NSA with same CBSA value as of REC project.

You will:

**Step 1: In Project NSA:**

* Trigger - Set up a webhook which listens to incoming request
* \*When a request comes in, you have access to values from its payload such as CBSA value or Issue Key of Project REC, (of course if sent)
* Using the CBSA Value from incoming request, do a look up of issues (looksupissues).
* if Size \> 0, links all issues returned by the lookup with the payload's issue.

Above step gives you an URL. You will use that URL in below step.

**Step 2: In Project REC:**

* Trigger: Issue created
* Condition: CBSA is not empty
* Action: Send a POST webrequest to above URL with JSON

{

"Issue": "{{issue.key}}",

"CBSA": {{ customfield_10178}}

}

------------------------------------------------------------------------------------

* In general, I start with Step 1 and create a skinny /skeleton rule to grab target URL.
* Then I create Step 2 rule fully to send web request
* Then I slowly build Step 1 to complete my rule.

I missed few details but above is the gist, please let me know if issues if you are testing this route.


author: Bill Sheboy
body: Hi [@Brandon](/t5/user/viewprofilepage/user-id/1698757)

Are these company-managed or team-managed projects? I am guessing they are team-managed, as you have the same field with two different custom field ids.

Out-of-the-box JQL cannot compare two different fields in this way. (It is not a SQL...) Instead you would need to test for the specific value (not the ids of the values) with your dynamic JQL statement. For example, assuming the custom field is a single-select list:

project = someProject AND someCustomField = "{{triggerIssue.OtherCustomField.value}}"

Another difference for your rule is scope: it will need to be multi-project or global to access the issues. Your Jira site admin can help create that rule in the global rules area.

Kind regards,  
Bill


Tags: compare

issue-link

smart-value