I am trying to translate the following in to a Groovy script and I am a complete noob when it comes to scripting. I can read a script and figure out for the most part what it should do but writing one is a completely different thing.
If Platform Engineering Team = Platform EU
I am trying to use this to assign a ticket to a role on create if the custom field (Platform Engineering Team) has value (Platform EU) set.
Please help me out.
Assuming this field is a select list, you could use:
if (cfValues['My Single Select']?.value == "Some value")
or do it the long-hand way, there are lots of examples of that here and in the docs: https://scriptrunner.adaptavist.com/latest/jira/
Always a fun day here on Atlassian Answers.
Daniel, the docs are listed here – https://innovalog.atlassian.net/wiki/display/JMWE/Post-functions. In this case, something like this should be close –
if ( issue.get("customfield_12345")?.value == "Platform EU" )
New error on ticket creation with that in place.
Error creating issue: startup failed: Script1.groovy: 1: unexpected token: @ line 1, column 62. 01")?.value == "Platform EU" ) ^ 1 error
I found two old questions that seem to have a similar error.
I took out the extra spaces in the script above from @Steve Behnke [DiscoverEquip.com] and the error just changed the column number to 60.
Thanks for the help and at least getting me to this point.
All the whitespace seems to be garbage, I am not sure why. The script condition I wrote has exactly 57 characters in it, so be sure to get all the whitespace out. I cleaned it up here, but I still haven't had time to test this further, sorry –
With no spaces what so ever I get the same error with the number being 57. Just to confirm that the plug in was working and it was just an issue with the Groovy in the field I removed the check from " Only if condition is true " and it did as it should. I need the Groovy to work or there is no sense in having the auto-assign option because it will be sending it to the Platform EU team.
Hey @Steve Behnke [DiscoverEquip.com],
You have been great. I removed the IF and now it is not throwing an error. It is not assigning it but that is not a fault of the script as much as the plugin. Now to figure out why that might be. I have checked roles and permissions for the project I am testing on which matches the project this is ultimately going in to.
Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot