I have JIRA Cloud Premium plan and have defined issuetype = Initiative above Epic.
In Epics parent field we specify the Initiative#.
Now I want few fields on Initiative to be populated at StandardIssue Type level like Story and Task in custom field.
Using automation how can i accomplish this.
I tried
For Parent
store {{issue.parent}} in a variable. i get the correct Initiative Key
Now what rule should i write so that custom field in the issue that triggered the rule, can be updated with field values of initiative key obtained above?
Hello @Vishal Biyani
Please show us the complete rule you have constructed so far.
If the trigger issue is the Story, and you want to get data from the issue two levels up (Story is child of Epic, which is child of Initiative), you can get that data without a For Each branch.
{{triggerIssue}} references the trigger issue - the Story.
{{triggerIssue.parent}} will reference the parent Epic of the Story.
{{triggerIssue.parent.parent}} will reference the parent Initiative of the parent Epic of the Story.
Tack onto that smart value the field name for the data you want from the Initiative; i.e. {{triggerIssue.parent.parent.status}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is very helpful and simplifies my logic.
I recently added the custom field (custom_10300). This field is available at all issuetypes. I want to populate this field on issue creation up to epic level, if it is empty.
So, if the trigger is sub-task, i can check for parent and update the field at story/task level. How do i check for Epic is not clear to me?
JQL: issuetype in subTaskIssueTypes()
if custom_10300 is empty
then edit (Advanced)
{
"fields": {
"custom_10300": "{{ triggerIssue.parent.parent.key }}|{{ triggerIssue.parent.parent.customfield_10182 }}|{{ triggerIssue.parent.parent.customfield_10183 }}|{{ triggerIssue.parent.parent.customfield_10184}}"
}
}
For Parent (Story/Task)
if custom_10300 is empty
then edit (Advanced)
{
"fields": {
"custom_10300": "{{ triggerIssue.parent.parent.parent.key }}|{{ triggerIssue.parent.parent.parent.customfield_10182 }}|{{ triggerIssue.parent.parent.parent.customfield_10183 }}|{{ triggerIssue.parent.parent.parent.customfield_10184}}"
}
}
How to go to epic level?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Vishal Biyani
I am slightly confused.
You original question was about bringing data from a higher level (Initiative) to a lower level (standard issues).
You new question seems to be about taking data from a lower level (sub-task) to a higher level (Epic).
Which scenario are you trying to address?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My objective is to get initiative details populated at lower levels (Epic, StandardIssue and SubTaskIssueTypes).
As per current scenario, it is possible that Epic and Standard IssueTypes under it don't have initiative details as these were already created.
Now, i create a subtask under StandardIssueType say Story. Using this event, i would like to populate the initiative details at Epic, Story [if missing initiative details] and the sub-task (new) that triggered the create event.
with the suggested rules, i am able to populate the details at Story and sub-task level. However, not clear how to get these details back to Epic level as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please show us the full rule you have constructed.
Have you considered using a Scheduled triggered rule to find existing issues with the empty fields and populate them rather than trying to populate them when a new child issue issue created under them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the rule i have
I didn't think about Scheduled trigger. That surely will reduce the complication if Epic is prepopulated.
However, would be good to know if they is way to update Epic if sub-task is updated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me see if I understand the intentions of your rule.
First, you are trying to create one rule that can be run for all types of issues that might be created.
You use If-Else blocks to determine what type of issue creation triggered the rule, and then update the current issue.
The first issue type you handle is the creation of an Epic. Since you are copying data from Initiative your Edit Action needs to go up just one level to get the data.
The next issue type you handle is the standard level issues; i.e. Story. These are the issue types that would be the child of an Epic.
Do I correctly understand that the "For: Current Issue" branch shown here is located directly after the "For: Parent" branch in the same image, as part of the Else-If block?
If I have understood that correctly, then within this block it looks like you are first checking to see if the issue's parent has the data (in the "For: Parent" branch) and filling it in there if the Epic is also missing the data. And then in the "For: Current Issue" branch you are trying to fill in the data in the standard level issue that triggered the rule.
It looks like you may have missed a scenario here where the standard level issue does not have a Parent Epic. You may want to add a condition in the "For: Current Issue" branch for that.
The last Else-If block appears to be for catching when a subtask type of issue has been created.
It looks like here maybe you are first updating the data in the subtask. Correct?
And then with the "For: Parent" branch you are going up to the subtask's parent to check if it has the data and if it doesn't then you are filling it in there also.
And now we come to your question. In this Else-if block, how can you go up one more level to check the Epic and fill it in if it is missing the data?
I believe (but have not tested it) that you could do the following:
Outside of the "For: Parent" branch, at the same level as the first Edit Issue in this block, add a "For: JQL" branch to change the context to the subtask's parent issue's parent Epic.
In the JQL for the branch use this:
issue = {{triggerIssue.parent.epic.key}}
That will shift the focus to the parent Epic for the issue that is the parent of the created subtask. Fill in the steps under that branch the same way you did in the other cases where you were branching to the Epic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is awesome. Works like a charm.
I could use {{ issue.parent.key }} etc. to populate Initiative details at Epic level when subtask is created under StandardIssueType.
Thanks so much for your patience and devoting your valuable time.
It gives a great perspective and opens up so many possibilities to use JIRA Automation.
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.