Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueInputParam Edited

Hi, we're trying to bulk copy a custom field to a system field using script runner, I thought I'd found an exisiting script within the questions section I could alter to copy the "Due Date" custom field values to the Due system field. 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.bc.issue.IssueService
import org.apache.log4j.Logger
import org.apache.log4j.Level
log.setLevel(Level.DEBUG)
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def query = jqlQueryParser.parseQuery("project = VME-R - OSMP") // change query to match the issues you want to update - escape quotes in query with \
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) // get results of query

results.getIssues().each {documentIssue -> // go through each issue
def issue = issueManager.getIssueObject(documentIssue.id)
log.debug("----------------------")
log.debug(documentIssue.key)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("Due Date");
def newValue = issue.getCustomFieldValue(customField)
def issueService = ComponentAccessor.getIssueService()
def issueInputParameters = issueService.newIssueInputParameters()

issueInputParameters.setDueDate(newValue); //copy Due Date to Due

//Copying data and Validating Update
def updateValidationResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters);
if(updateValidationResult.isValid()) {
def updateResult = issueService.update(user, updateValidationResult);
log.error("Update Result Done without error. Assignee is " + updateResult.getIssue().getAssignee());
}else{
log.error("Update Validation Result not Valid.");
}
}

 

However I'm getting the errors below.

Result:

com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseClause(DefaultJqlQueryParser.java:110)
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseQuery(DefaultJqlQueryParser.java:33)
at com.atlassian.jira.jql.parser.JqlQueryParser$parseQuery.call(Unknown Source)
at Script37.run(Script37.groovy:16)
Caused by: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.antlr.JqlParser.reportError(JqlParser.java:203)
at com.atlassian.jira.jql.parser.antlr.JqlParser.operand(JqlParser.java:1868)
at com.atlassian.jira.jql.parser.antlr.JqlParser.terminalClause(JqlParser.java:672)
at com.atlassian.jira.jql.parser.antlr.JqlParser.notClause(JqlParser.java:555)
at com.atlassian.jira.jql.parser.antlr.JqlParser.andClause(JqlParser.java:432)
at com.atlassian.jira.jql.parser.antlr.JqlParser.orClause(JqlParser.java:366)
at com.atlassian.jira.jql.parser.antlr.JqlParser.clause(JqlParser.java:328)
at com.atlassian.jira.jql.parser.antlr.JqlParser.query(JqlParser.java:237)
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseClause(DefaultJqlQueryParser.java:103)
... 3 more
Caused by: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.antlr.JqlParser.operand(JqlParser.java:1708)
... 10 more

 

Log:

2020-03-02 11:01:10,841 WARN [common.UserScriptEndpoint]: Script console script failed:
com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseClause(DefaultJqlQueryParser.java:110)
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseQuery(DefaultJqlQueryParser.java:33)
at com.atlassian.jira.jql.parser.JqlQueryParser$parseQuery.call(Unknown Source)
at Script37.run(Script37.groovy:16)
Caused by: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.antlr.JqlParser.reportError(JqlParser.java:203)
at com.atlassian.jira.jql.parser.antlr.JqlParser.operand(JqlParser.java:1868)
at com.atlassian.jira.jql.parser.antlr.JqlParser.terminalClause(JqlParser.java:672)
at com.atlassian.jira.jql.parser.antlr.JqlParser.notClause(JqlParser.java:555)
at com.atlassian.jira.jql.parser.antlr.JqlParser.andClause(JqlParser.java:432)
at com.atlassian.jira.jql.parser.antlr.JqlParser.orClause(JqlParser.java:366)
at com.atlassian.jira.jql.parser.antlr.JqlParser.clause(JqlParser.java:328)
at com.atlassian.jira.jql.parser.antlr.JqlParser.query(JqlParser.java:237)
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseClause(DefaultJqlQueryParser.java:103)
... 3 more
Caused by: NoViableAltException(59@[])
at com.atlassian.jira.jql.parser.antlr.JqlParser.operand(JqlParser.java:1708)
... 10 more

 

Any help would be greatly appreciated, thanks.

1 answer

0 votes

Hi! 

Please, wrap into try catch the next expression 

def query = jqlQueryParser.parseQuery("project = VME-R - OSMP") // change query to match the issues you want to update - escape quotes in query with \
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) // get results of query 

reduce the exception JqlParseException

Suggest an answer

Log in or Sign up to answer
TAGS

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