Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira DataCenter - ScriptRunner - Auto-transition on subtasks not working


I had a ticket open for this in Adaptavist support as well. 

We upgraded our Jira Server and all add-ons including ScriptRunner to Data Center this past weekend. We upgraded ScriptRunner by several versions during this process.

After the migration, our users noticed that the auto-transition of subtasks was working on and off. I am including the script here. This script works at times and other times I dont think it does anything. We added some log warn statements to follow the script execution but nothing is seen in the logs. However, the screen status says it successfully executed for a Jira Issue and we can confirm that in the Payload.

Last night, I spent some more time troubleshooting and it turned out commenting out the following line in the script - "setSkipScreenCheck(true)", fixed the Issue. No comments are being added to the subtasks during the transition but that is less of an Issue now. I understand "setSkipScreenCheck(true)" is to add comment on a ticket when the field is not available on the Edit screen. Not sure why that would affect the transition, though.


Here is the original Parent Issue PostFunction script

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.issue.fields.CustomField

CustomField deplInEnv = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Deployed in Environment")

IssueService issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getUserManager().getUserByName("automation")
for(Issue subTask:issue.getSubTaskObjects()) {
if ((subTask.getStatusId() == "10102") && ((!subTask.getCustomFieldValue(deplInEnv)) || (!subTask.getCustomFieldValue(deplInEnv)*.value.contains('Stage')))) {
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setComment("Moving subtasks to ToDo from Parent Deployment Request")
// validate and transition subtask
def validationResult = issueService.validateTransition(user, subTask.getId(), 111, issueInputParameters)
if (validationResult.isValid()) {
def issueResult = issueService.transition(user, validationResult)
if (! issueResult.isValid()) {
log.warn("Failed to transition subtask ${subTask.key}, errors: ${issueResult.errorCollection}")
} else {
log.warn("Could not transition subtask ${subTask.key}, errors: ${validationResult.errorCollection}")


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across Jira Cloud instance.   📢 Get y...

117 views 6 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you