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
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
I have a scriptrunner script, and all seems well until the last line:
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cf1 = customFieldManager.getCustomFieldObjectsByName("New Hire Account provisioning");
def nhap = cf1.iterator().next();
def nhapvalue = issue.getCustomFieldValue(nhap);
if (nhapvalue == "Egencia")
invalidInputException = new InvalidInputException("Don't forget to provide the full legal name.")
I get the message "[Static type checking] - The variable [invalidInputException] is undeclared." I've used this exact structure in another script, and it works flawlessly; I'm baffled as to why it isn't working here. Any ideas?
If it is a static type error, does it mean that you haven't actually run it yet? Do you mean that you are getting one of the small red crosses in your code?
If so, that could mean that it isn't broken at all. Could you save the script and run it?
Please indicate where both of the scripts are located. It's likely that one of the locations has InvalidInputException already within scope, whereas the location you're trying to use it in now does NOT have it in scope.
Perhaps just trying defining the variable?
invalidInputException = new InvalidInputException("Please provide the full legal name")