Copy custom field with jira automation Json when creating a subtask

Diego Sanchez Cambas December 15, 2022

Hi!

I have a board in which I have a custom field with a dropdown list and sublist. I´m trying to automate copying this field of the main issue into the subtask that  is being created, but I don't seem to find the correct Json expression:
This is what I have right now:

{
"fields": {
"customfield_10463": { "value": "{{parentIssue.customfield_10463.value}}", "child": { "value" : "{{parentIssue.customfield_10463.child.value}}"} }
}
}

 

 

The trigger is when an issue is created and has a condition that is when the issue type is a subtask

Thank you!

2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2022

Is your rule generating an error message in the audit log? If so, what is the error message?

Can you use Log actions to print to the rule audit log the values for the parent issue field to make sure you are getting the values you expect? 

{{parentIssue.customfield_10463.value}}

{{parentIssue.customfield_10463.child.value}}

Diego Sanchez Cambas December 16, 2022

Hi Trudy! Will leave you a screenshot down below

Diego Sanchez Cambas December 16, 2022

Hi @Trudy Claspill , 

Is not getting any error message, it says Success, but with the log actions, both values come up empty. I double-checked the custom field ID and it is right, I have an automation that can copy this field, but only when the issue is transitioned, I copied the CF Id from there. I´m not sure why is coming up empty in this automation.

I tried with your log action Json with another custom field that is being copied in another automation and it comes up also empty on the audit log.

 

My trigger is when an issue type "Candidate" (subtask) is being created, then it compares the issue type to ensure is type "candidate" and then the action is the Json to copy the field from the parent issue into the new subtask, followed by the Log actions you recommended.

Screenshot automation V2.png

 

I´m not sure why the custom field on the parent issue always comes up empty, including other custom fields that I tried. I don´t think is the Json anymore, but the reason why is not bringing the values. Is there any way I can fix this?

Thank you Trudy!

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 16, 2022

Hello @Diego Sanchez Cambas 

Teachable moment:

As a next debugging step I would try printing out {{parentIssue.key}} to make sure you are referencing a valid issue.

If you don't get the value you expect, then that would suggest that you are not referencing the parent issue correctly. At that point I would start looking at the documentation, which is exactly what I did.

From reviewing documentation on Smart Values I have discovered that you are referencing the parent issue incorrectly. Refer to

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--issue.parent--

Instead of parentIssue you need to be using issue.parent so that the automation know which issue's parent you are referencing.

Like Diego Sanchez Cambas likes this
Diego Sanchez Cambas December 16, 2022

Hi @Trudy Claspill 

I tried with the Issue.parent and that worked perfectly! thank you very much!!!

0 votes
Diego Sanchez Cambas December 16, 2022

.

 

Suggest an answer

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

Atlassian Community Events