Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,888
Community Members
 
Community Events
176
Community Groups

Copy value from Custom field 1 to Custom Field 2 with Automation

Edited

Hi - 

Could someone give me the json format to to copy value from customFieldId=10060 & set it to customFieldId=10014 inside the same issue that I could use in Automation for JIRA for JIRA cloud.

Unfortunately, it does not populate the source custom field in the [Copy From] dropdown to copy to customFieldId=10014 in the UI, so I think I'll need the json to set that, attachment added for reference.

Thanks in advance!

Screen Shot 2019-04-10 at 12.52.46 PM.png

8 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

I used the above code and it did not work, I did have to modify it a bit

 

{
"fields": {
"customfield_10014": "{{issue.customfield_10060}}"
}
}

Adding quotes around the copy from custom field if anyone else runs into the issue. 

Deleted user Aug 20, 2021

It works for me!
Thanks! 

What is the logic for adding the quotes ?

just the formatting for JSON

"objectname" : "objectvalue"

Like Pratik Gaad likes this

If anyone comes across this, I wasn't having trouble with a straight text field or numeric field to text field or numeric field.  I was having trouble when the copy value was to be populating a dropdown.  

As such, I had to use the JSON format to post the field by name and then the value I was trying to pass.  

Example:

{
  "fields": {
        "Billing Type": {
            "value": "{{issue.parent.fields.customfield_12127.value}}"
         }
    }
}

The "Billing Type" name was sourced by viewing the REST-API version of an issue (although, it's most likely the same as what you see in the UI).  You can view the REST-API version to also assist on finding the path for what you are looking for as the value and/or enumerations.  You can use this link:
https://<your_instance>.atlassian.net/rest/api/2/issue/<your_issue_id>?expand=names

@Nick Menere how should I update the above code so that the custom field from the epic is copied to the user story? The custom field is "customfield_10001" so I tried the following and it is not working: 

{
"fields": {
"customfield_10001": {{issue.parent.epic.customfield_10001}}
}
}

I am struggling with this exact same issue. I keep getting 'Invalid JSON Errors' but as far as I can tell I've formatted exactly as others suggested but completely unable to find a way to copy the field from the parent. 

Looks like I had a rogue space in my json so I fixed the invalid json error. I also found out that the correct way to get the parent if you are working with a child of an Epic is {{issue.epic.customfield_10001.id}} apparently parent is for sub-tasks ¯\_(ツ)_/¯

 

I was able to get this to work a few of times but it suddenly just stopped updating the field no errors, all my log outputs show all the same good values from when it worked but I'm back to the automation telling me it succeeded and nothing actually changing.

 

I have an instance from my successful runs in my log where the automation tells me it succeeded, the log output says it set my custom field to null but it had actually updated correctly in the UI. :/

1 vote

Hi Anuj,

 

This will come down to what kind of field the 2 fields are. You should be able to copy between number and test fields.

Basically it should be something like:

{
"fields": {
"customfield_10014": {{issue.customfield_10060}}
}
}

But as I said, depends on the type of fields.

Cheers,

Nick

@Nick Menere - thanks, I'm going to try that & let you know.

@Nick Menere - it worked like mint, thanks a lot!

Hello @Anuj B @Nick Menere 

I'm running into the same problem ! 

I'm trying to copy one value from a custom field to another one on the same issue.

It doesn't work for issue created trigger rule, but it works perfectly for field value changed trigger rule !

I tried Json format as suggested above, it doesn't work. I also tried using the UI automation wizard (when, if, then) but no use !

Both custom fields are of type Select List (single choice) with the same values and None as a default value

@Abdelwahed SAMRI see my post below; you may be running into the same issue I was in relation to the dropdown (i.e. list).

Does anyone know some alternative for copy any fields with automation option?

I have been able to get this working but only as a manual trigger on an issue after it's been created and saved. Is there some delay in the custom fields being available during the issue creation?

 

Edit: after playing around a little more I think I have this working, kinda.

I use this in the additional fields edit box:

{
"fields": {
"customfield_10001" : "{{issue.epic.customfield_10001.id}}"
}
}

 

I run the automation on a trigger when the issue is created and have logging to check the {{issue.epic.customfield_10001.id}} has a value during the run. This is always coming back with a value.

I also log the new issues value for customfield_10001 this is always coming back as null despite the log telling me the field was successfully updated right before this entry.

When I create my child item in JIRA it is saved with a blank in the custom field but when I refresh the browser the field value I expected is then populated.

I've added a retrieve issue step in my automation routine, which seems to do nothing at all and I can't trigger a refresh browser so may have to live with this glitch.

@Nick MenereIs it possible to copy Date field? I am trying to copy Due Date(Standard field) to a custom field.

Please help!

Hi, 
I tried using the above query for copying components into a project picker field:

{
"fields": {
"{{issue.components.name}}":  {{issue.customfield_12700}}
}
}

I want to copy the component into the Project picker field (field number used here) but it doesn't work?


Could you please help?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS

Atlassian Community Events