You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.