Getting this error below while running the below code ,
Transition Validation errors: It seems that you have tried to perform a workflow operation (Done) that is not valid for the current state of this issue (ILAB-1251). The likely cause is that somebody has changed the issue recently, please look at the issue history for details.
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.workflow.TransitionOptions
import com.atlassian.jira.config.SubTaskManager
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue
import org.apache.commons.lang3.StringUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory;
Logger log = LoggerFactory.getLogger("Subtask transition script")
//def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("RFA-467")
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager();
Collection<Issue> subTasks = issue.getSubTaskObjects()
log.error("Found {} subtasks of <{}> issue, starting transitions", subTasks.size(), issue.getKey())
if (subTaskManager.subTasksEnabled && !subTasks.empty)
{
IssueService issueService = ComponentAccessor.getIssueService()
CommentManager commentManager = ComponentAccessor.getCommentManager()
String comment = "Moving to *new status* status as a result of the *this transition* action being applied to the parent.";
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
TransitionOptions transitionOptions = new TransitionOptions.Builder().skipConditions().skipPermissions().skipValidators().build()
subTasks.each {it ->
log.error("Try to transition subtask <{}>", it.getKey())
// In validateTransition method you should write transtion id, in this example 21
IssueService.TransitionValidationResult transitionValidationResult = issueService.validateTransition(user, it.getId(), 71, issueInputParameters, transitionOptions)
if (transitionValidationResult.isValid()){
IssueService.IssueResult issueResult = issueService.transition(user, transitionValidationResult)
if (!issueResult.isValid()){
String cause = StringUtils.join(issueResult.getErrorCollection().getErrorMessages(), "/")
log.error("Transition errors: {}", cause)
}
else{
log.error("transition issue <{}>, finished with result <{}>, adding comment", it.getKey(), issueResult.isValid())
commentManager.create(it, user, comment, true);
}
}
else{
String cause = StringUtils.join(transitionValidationResult.getErrorCollection().getErrorMessages(), "/")
log.error("Transition Validation errors: {}", cause)
}
}
}
Hi @Praveen
You are trying to perform transition 71. But it is not applicable for ILAB-1251. Please check the issue status and also outgoing transitions to verify that 71 is available in workflow.
This is my workflow details please let me know what is wrong in this
Open (1) OPEN In Progress (11)
>> IN REVIEW
Add transition Delete Transitions Edit View Properties
In Progress (2) IN REVIEW Open (21)
>> OPEN
In Review (31)
>> IN PROGRESS
Add transition Delete Transitions Edit View Properties
In Review (3) IN PROGRESS In Progress (41)
>> IN REVIEW
In Testing (51)
>> IN TESTING
Add transition Delete Transitions Edit View Properties
In Testing (4) IN TESTING Done (71)
>> DONE
In Review (91)
>> IN PROGRESS
In Progress (121)
>> IN REVIEW
Add transition Delete Transitions Edit View Properties
Done (5) DONE In Testing (61)
>> IN TESTING
Released (81)
>> RELEASED
In Progress (111)
>> IN REVIEW
Add transition Delete Transitions Edit View Properties
Released (6) RELEASED Done (101)
>> DONE
Add transition Delete Transitions Edit View Properties
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Transition id 71 is available here.
In Testing (4) IN TESTING Done (71)
issueService.validateTransition(user, it.getId(), 71, issueInputParameters, transitionOptions)
What is the ILAB-1251 status?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It has already been in Done status. So, script validation throws an error.
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.