Hi All,
I'm new to jira scriptrunner 6.7.0.
I've two project (Project A & Project B). Based on post-function on Project B, i want it to force change the issue status Project A.
Need your help.. It's possible?
Below code it will transition FLD-400 to "Cancelled". but when i ran, it return error as below. Can someone help?
I got error as below, seem like coming from line "transientVars["Cancelled"] as int"
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead at Script463.run(Script463.groovy:74)
Code as below:
def issueA = issueManager.getIssueObject("FLD-400");
//Test issue service. Transition the issue at FLD
def issueService = ComponentAccessor.getComponent(IssueService);
issueService.getIssue(user, "FLD-400");
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.setComment("This is a comment");
issueInputParameters.setSkipScreenCheck(true);
def transitionOptions= new TransitionOptions.Builder()
.skipConditions()
.skipPermissions()
.skipValidators()
.build()
//Get the action id (trasition id)
def actionID = transientVars["Cancelled"] as int;
def transitionValidationResult = issueService.validateTransition(user, issueA.id, actionID, issueInputParameters, transitionOptions)
if (transitionValidationResult.isValid()) {
issueService.transition(user, transitionValidationResult).getIssue()
}
log.error "Transition of issue ${issueA.key} failed. " + transitionValidationResult.errorCollection
You can't just cast an object to an integer and hope the computer can guess what you want it to do. You'll need to unpack transientVars in full and extract the action id from it.