Copy custom field value from project A to linked epic in project B
Asked by Daniel Wilde:

hi community,

my dilemma is an automation rule which I couldn't get running.

We want to copy a value from a custom field (10134) of issuetype X in project A to its linked issues of issuetype epic in project B. The issues are linked with type "relates". Both issuetypes are using the custom field (10134). The rule shall perform once a day.

* Trigger: scheduled (on a daily base)
* condition 1: project A with issues of type X which have values in custom field (10134) and which are linked via "relates to" to issues of type epic in project B
* action: copy value from custom field (10134) from issues of type X in project A to the same custom field (10134) of its specific linked issues of type epic in project B

I'm struggling with the configuration.


Answers:
author: Marc - Devoteam
body: Hi [@Daniel Wilde](/t5/user/viewprofilepage/user-id/5585899)

You need to use a branch in your rule based on linked issues of the type relates to.

Branch after your condition.

Example:

![Screenshot 2024-09-06 at 14.03.02.png](https://community.atlassian.com/t5/image/serverpage/image-id/345977iADA3E538F4C4EEE7/image-size/large?v=v2&px=999 "Screenshot 2024-09-06 at 14.03.02.png")

comments: author: Daniel Wilde
body: hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976),

thanks for quick answer. Similiar configurations I've tried already but as you can see in the second screenshot, the audit log tells me that there is no issue found.

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

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


author: Marc - Devoteam
body: Hi [@Daniel Wilde](/t5/user/viewprofilepage/user-id/5585899)

What is the config of the scheduled trigger, is there a JQL clause stated?

If so remove it, as the JQL is in your clause.


author: Daniel Wilde
body: Hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976)

Your last answer brought me on the right way.

<br />

I used "issuetype = epic" for the trigger but as you wrote correctly it was redundant. Instead I changed the trigger's jql request to "project = PN AND issuetype = Projekt AND "ZEP-Projekt (Link)" != Empty". "type = epic" is now used just once in branch's condition (key = ... was only for a test run).

Hopefully, it does now what i expect.

One additional question: Soon, I'd like to add more issue fields but I only wanna copy values from issues where the fields aren't empty. How can I request that for several fields where at least one of it is not empty? And would the rule also copy empty fields to a maybe non-empty field? That would be counterproductive.

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


author: Marc - Devoteam
body: Hi [@Daniel Wilde](/t5/user/viewprofilepage/user-id/5585899)

Then you would need IF/ELSE clause and then branch in the clause.

Yes if you copy fields on the eit and the field is empty, the existing value will be overwritten.


Tags: cloud

cloud-automation

jira-cloud