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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Automation for JIRA] copy value from Custom field 1 to Custom Field 2

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

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. 

It works for me!
Thanks! 

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

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 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. :/

@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?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

386 views 3 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you