This is NOT when creating an issue. This is for editing.
Let's say after a week after the issue was created. The parent issue's priority is changed from high to critical. Is it possible for an automation rule to update the subtask priority?
You can build a script listener with the following code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
if(!event.issue.getSubTaskObjects()){
return
}
def customFieldManager = ComponentAccessor.customFieldManager
if(event.issue.getSubTaskObjects()){
def subtasks = event.issue.getSubTaskObjects()
def parentField = customFieldManager.getCustomFieldObjectByName("Your Parent Field's Name").getValue(event.issue)
subtasks.each {
def subtaskField = customFieldManager.getCustomFieldObjectByName("Your Subtask Field's Name")
def changeHolder = new DefaultIssueChangeHolder()
subtaskField.updateValue(null, it, new ModifiedValue(subtaskField.getValue(it), parentField), changeHolder) }}
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.