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) }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.