I am trying to execute a transition when clicking on a menu item in Jira Data Center. I have tried the following code. It is using the APIs workflowTransitionUtil.setAction, workflowTransitionUtil.validate and workflowTransitionUtil.progress and it also fails. I am creating a custom post function for a transition. I am getting the errror:
Caused by: org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.
com.atlassian.jira.transaction.TransactionRuntimeException: org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.
org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.
2022-08-17 11:31:55,313+0200 https-openssl-nio-443-exec-533 ERROR mouh 691x78439x26 1a2i7f4 10.248.140.0 /secure/CommentAssignIssue.jspa [c.a.jira.transaction.TransactionSupportImpl] Unable to commit transaction : Commit failed, rollback previously requested by nested transaction.
Could you please let me know about the solution? My transition is leading to itself and I would like to execute it even though it is leading to itself.
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.workflow.JiraWorkflow
import com.atlassian.jira.workflow.WorkflowManager
import org.apache.log4j.Logger
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.user.ApplicationUser;
def log = Logger.getLogger("atlassian-jira.log")
log.warn("test")
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();
JiraWorkflow workflow = workflowManager.getWorkflow(issue);
def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName();
ApplicationUser mycurrentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
log.warn("This is the last action done "+actionName)
log.warn("CAM 2")
int transitionToBeDoneInt = 1731 //ID of MounaTransition
log.warn("cam 3 " +transitionToBeDoneInt)
def myComment= "+++ added via workflow action "+actionName+"\"+++"
log.warn("cam 4 "+actionName)
def content =( transientVars["comment"] +"\n"+myComment )as String
log.warn("cam 5 "+ content)
transientVars["comment"]= content
log.warn("cam 6"+ content)
log.warn("CAM 7 "+ issue.getKey())
def inputParameters = ComponentAccessor.getIssueService().newIssueInputParameters();
log.warn("CAM 8 "+ " "+issue.getId()+" "+ transitionToBeDoneInt+" "+inputParameters)
def workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class )
workflowTransitionUtil.setIssue(issue)
workflowTransitionUtil.setUserkey(mycurrentUser.getKey())
workflowTransitionUtil.setAction(transitionToBeDoneInt);//Id of the status you want to transition to
log.warn("CAM 9 "+ " "+issue.getId()+" "+ transitionToBeDoneInt+" "+inputParameters)
workflowTransitionUtil.validate()
log.warn("CAM 19 "+ " "+issue.getId()+" "+ transitionToBeDoneInt+" "+inputParameters)
workflowTransitionUtil.progress();
log.warn("CAM 11 "+ " "+issue.getId()+" "+ transitionToBeDoneInt+" "+inputParameters)
Same answer as last time - stop trying to transition an issue inside a transition, it won't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.