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

Error updating status through Scriptrunner Edited



I have written a script to  extract claim numbers and then if there is a single unique claim number, update the status on the issue. But when I try to execute the script, I get the below error. 


The claim number updates in the field when I remove the logic to update the status and the code for updating the status runs perfectly fine when I run it on the console. But the problem arises when I run this as part of an automation rule triggered when issue is created.  Can you please help with what I am doing wrong?


"Script function failed on Automation for Jira rule: Read and set Claim Number, Issue Type, file: <inline script>, No signature of method: is applicable for argument types: () values: [] Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), tap(groovy.lang.Closure)"


Script - 


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.comments.CommentManager
import java.util.regex.Pattern
import java.util.regex.Matcher
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.issue.MutableIssue;

def summary=issue.getSummary()
def description=issue.getDescription()
def claimNumbers =[]
def issueManager = ComponentAccessor.issueManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
MutableIssue issueToUpdate = (MutableIssue) issue;

//The transition ID is now hardcoded for To Be Processed. Change this to accomodate all statuses
def tobeProcessedTransitionId = 21
def workflowManager = ComponentAccessor.getWorkflowManager()
def workFlow = workflowManager.getWorkflow(issue)
def issueService = ComponentAccessor.issueService()

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def claimNumberField = customFieldManager.getCustomFieldObjects(issueToUpdate).find { == "Claim Number"}

//Match claim number pattern WCQ****** and return a list of claim numbers from Summary
def claimNumbersInSummary = summary.findAll(Pattern.compile(/\bWCQ[0-9]*/,Pattern.CASE_INSENSITIVE))
//Match claim number pattern WCQ****** and return a list of claim numbers from Description
def claimNumbersInDescription
def claimNumbersInDescriptionUpperCase

def claimNumbersSummaryUpperCase = claimNumbersInSummary.collect{it.toUpperCase()}

claimNumbersInDescription =description.findAll(Pattern.compile(/\bWCQ[0-9]*/,Pattern.CASE_INSENSITIVE))
claimNumbersInDescriptionUpperCase = claimNumbersInDescription.collect{it.toUpperCase()}
//This is to remove duplicate claim numbers regardless of case

// Convert claim numbers list to comma separated string
String claimNumbersCommaSeparated=claimNumbers.asList().join(",").toString()

//Update Claim Number field in the issue
if (claimNumberField) {
def changeHolder = new DefaultIssueChangeHolder()
claimNumberField.updateValue(null, issueToUpdate, new ModifiedValue(issueToUpdate.getCustomFieldValue(claimNumberField), claimNumbersCommaSeparated),changeHolder)


log.warn(" Cliam Numbers Size: " + claimNumbers.size())
log.warn("Workflow transitions:"+workFlow.getLinkedStep(issue.getStatus()).getActions().name)
def transitionValidationResult = issueService.validateTransition(currentUser,,tobeProcessedTransitionId, new IssueInputParametersImpl())
def issueObjectID = issueToUpdate.getId()

log.warn("Transition Valid? :" +transitionValidationResult.isValid())

if (transitionValidationResult.isValid()) {
def transitionResult = issueService.transition(currentUser, transitionValidationResult)





0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

199 views 3 7
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