Hi,
Is there an automation rule that I can create that takes the value of a previous sub-task custom field and copy it to its parent?
For example, we have a parent issue with 3 identical sub-tasks and fields. All issues, parent and sub tasks have a select list called “Result” with the values “Pass, Fail, Ignore”.
Sub task 1 has “result=pass”, sub-task 2 has “result=ignore” and sub-task 3 has “result=fail”.
The value for sub-task 3 (fail) copies itself to the parent issue field. So both parent and sub-task 3 show the result as fail. This rule is working fine, copying a value from the latest sub-task to a parent issue.
However, say we drop or delete sub-task 3. We then want to update the value of the parent result of the last sub task, so in our case, sub-task 2 with result ignore.
Is this possible, any branch rule or clever JQL that can achieve this?
thanks
It is possible to achieve that, but it will require multiple rules due to the way Jira/Automation currently works
<BaseURL>/rest/api/2/search/?jql=%22Parent%22={{issue}}%20and%20status%20!%3D%20dropped%20Order%20by%20key%20desc&fields=customfield_13501
Replace <BaseURL> with your base URL. Replace customfield_XXXXX with the ID of your Result custom field (eg. customfield_10600)
{{webhookResponse.body.issues.fields.customfield_XXXXX.value.first}}
The rules works as below
Hello @Nadeem Zakir
How do you identify which subtask is "last"? Is it based on Creation date or something else?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How would you "drop" a subtask? Is "dropping" the subtask the same as deleting the subtask issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dropping in our case, meaning a workflow status, similar to Done, but instead we Drop them, so thats the last status. So technically, say out of the 3 sub tasks, we transition sub task 3 to drop. This would then copy the Result field from sub task 2 to the parent. You can ignore what I wrote earlier about deleting the sub task.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Something like this should work.
When an issue is Dropped
And that issue is a sub task
Find its Parent issue
Then look up all the subtasks for that parent where the subtasks are not Dropped
Order these by creation date in descending order so the first on in the list is the most recently created subtask
Make sure the result set has at least one issue in it.
Set the parent issue Result field to match the Result field of the first issue in the result set (the most recently created subtask)
TRIGGER: Issue Transitioned
To Status: Drop
CONDITION: Field Value
Field: Issue Type
Comparison: equals
Value: Sub-task
BRANCH: Related Issues: Parent
ACTION: Lookup Issues
JQL: parent = {{issue.key}} and status != Drop order by Created desc
CONDITION: Advanced Compare
First Value: {{lookupIssues.size}}
Comparison: is greater than
Second value: 0
ACTION: Edit issue
Field: Result
Value: {{lookupIssues.first.Result}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What does it mean to, "drop" a subtask? Does "dropping" the subtask mean that the subtask problem has been deleted?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It appears that @Nadeem Zakir is using Jira Server, and not Jira Data Center or Jira Cloud. And so the action Lookup Issues is not available.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, sorry should have made it clearer, we are using Jira Data Centre.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill I think your suggestion is on the right track. I have created an automation rule as you suggested using lookupissues, the rule runs and says success but the "result" field at the parent level gets cleared after I transition the sub task to drop rather than taking the last sub tasks "result" value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you show us the rule you constructed and the Audit Log for the rule execution?
Where I used "Result" in the smart values you would need to use the actual name of your field. What is the actual name of the field, with the correct capitalization?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information!
Would you also please show an image of the details of the Edit Issue Fields action?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you show us the full smart value you are using to set the field?
Did issue 13772 have a value for Attestation Result?
Could there be subtask that don't have a value for that field? If the field has no value, do you still want the parent issue field set to match? Or do you want the parent field set to match for the latest subtask that does have a value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Trudy Claspill @Bill Sheboy thanks both for helping out. The field Attestation result is always populated on the sub task and the parent. It copies from the sub task to the parent. Have attached more images.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let's please get very specific on the symptom. This is what you stated earlier:
...the rule runs and says success but the "result" field at the parent level gets cleared after I transition the sub task to drop rather than taking the last sub tasks "result" value.
What exactly do you mean by "the last sub task"? Is this based on the created date, the summary, or some other field?
The current rule uses JQL and Lookup Issues to find the last created subtask which has not been Dropped.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Nadeem Zakir
How do you identify which subtask is "last"? Is it based on Creation date or something else?
Correct, based on creation date.
Like
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Trudy! I saw those posts but when I noted the symptom I wanted to confirm shared understanding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type of field is Attestation Result?
Can you add a Log action after the condition where you check the lookupIssues.size result, and print to the Audit Log the value in the smart value you are using - {{lookupIssues.first.Attestation Result}}
Then trigger the rule agains and show us the Audit Log again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you look at the Control issue, which is the parent. That has two sub-tasks, one is done and one is in progress. Both those sub tasks have an attestation result, “no instance in the period” and “pass” respectively. Sometimes, we need to transition a sub-task to Dropped, in this case, lets say the sub task that has passed.
What we are trying to achieve then, is for the attestation result to be taken from the other sub-task with the value “no instance in the period” and have that copied over to the attestation result field on the parent. Its the same field for both sub task and parent, under the attestation tab.
How do we determine what sub task to use? We use the sub task that was created last, using the created date. So we could end up with 8 sub tasks. created in order, 1,2,3,4,5,6,7 and 8. Sub task 8 gets dropped so the rule copies the attestation result of sub task 7 to the parent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The log is not printing a value for Attestation Result for issue 13772.
So, either the smart value being used is incorrect, or there is something about that type of field that requires the user of a different smart value.
You can try using the custom field id instead:
{{lookupIssues.first.customfield_13501}}
Also, what type of field is Attestation Result?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its a single choice select list, I have tried using the name and the ID of the field. So still no luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your assistance, Atlassian supported provided a way on how to achieve what I wanted, works perfectly. Have posted the answer above.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.