Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I copy a custom field from one project/issue to the Comment field of another project/issue

trthomas
Contributor
September 25, 2023

I have 2 projects that I need to copy information between.  I need to know how to copy information from a custom field in an issue (project 1) to the comment field in another issue (project 2).  

Any assistance with which automation rule to use and the associated JSON needed would be greatly appreciated. 

 

2 answers

2 votes
Trudy Claspill
Community Champion
September 25, 2023

Hello @trthomas 

How are the two issues related? Are they linked together? Is there a custom field in the source issue that holds the issue key for the other issue?

When do you want that update to occur? Should a comment be added every time the custom field changes?

This can likely be accomplished through an Automation Rule, depending on how you can identify from the Project 1 issue the Project 2 issue that needs to be updated.. The rule would have to be set up as a Global Automation rule since it involves issues in multiple projects.

trthomas
Contributor
September 26, 2023

Thank you @Trudy Claspill 

In project 1 I have an automation rule set up to create a similar issue in project 2.  The automation rule copies those fields that are the same in both projects, but project 2 doesn't have all the fields set up, nor does the owner of the project want them set up.  So instead I would like to copy the unique fields from project 1 into the comment field of project 2.  The automation rule I have set up to create the project 2 issue is triggered manually from Actions.  There are no problems in creating the project 2 issue.  

I want the update to occur 1 time only.  It can be a manual trigger, though I would prefer the first automation rule to trigger this second automation rule.  

The custom fields in project 1 should not be changing, so no further updates would be needed beyond the initial update. 

The only problem that I am having is getting the custom fields to copy its contents into the comment field in project 2.  Labeling the comment field, such as Label: comment, would be ideal.

Trudy Claspill
Community Champion
September 26, 2023

The rule needs to be able to identify the source issue and the destination issue.

Somehow you have to record a relationship between the two issues that can be leveraged by the rule.

If you use a manually triggered rule that a user triggers from the source instance, then you could prompt the user to enter the issue key of the destination instance.

Alternately, you could create a link between the source and destination issues, and a rule can find the destination issue based on that link.

If you want the first rule to trigger the second rule, then you could use the Issue Created trigger to detect the creation of the destination issue. You still need some way for the rule to identify the source issue in that case.

Because the rule is interacting with issues from two different projects it will need to be a Global automation rule. You will need to identify the source and destination projects within the rule scope.

To add a comment you will need to use the Comment on Issue action.

The exact smart values for getting the information from the source issue will depend on how the rule is triggered and how the other issue in the pair is identified for the rule.

1 vote
Joseph Chung Yin
Community Champion
September 25, 2023

@trthomas -

In addition to what @Trudy Claspill stated, you need to determine what is the triggering event in Project 1 that will update Project 2 content (i.e. copying the custom field value in Project 1's issue to Project 2 issue as a comment).  The main key you need to also know is how are Project 1's issue is related to Project 2's issue?

Only the above two main elements are identified, then you can establish the necessary global automation rule(s) to perform the actions between Project 1 and 2.

Hope this also helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

trthomas
Contributor
September 26, 2023

Thank you @Joseph Chung Yin 

The triggering event is an automation rule that is triggered manually from Actions. 

The only correlation between the 2 projects is that project 1 will create the issue in project 2 when the manual rule is triggered. 

I am good with either of these scenarios:

1. The same automation rule that creates the issue in project 2 will also copy custom fields from project 1 into the comment field(s) of project 2. 

2. A separate automation rule is ran that will copy the custom fields from project 1 into the comment field(s) of project 2. 

I just can't seem to come up with the JSON necessary to copy those custom fields from project 1 over to the comment field in project 2.  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events