We would like to add Component/s to a ticket, based on key words that may be mentioned in the Description field. Are there any resources to learn about what the syntax is for Groovy to parse the Description field and look for certain words, then add those Component/s via Listener or some other means?
Hi @Jon Jones
Groovy is a script language based on Java.
Also, there are plenty example of how to use groovy over the internet (just try to google).
Eventually the value returned in script for field "Description" is a long String, so all you need is to parse a string and look for the value you want.
Thank you @Nir Haimov! Unfortunately my google search fu isn't up to snuff because I did try to search for specific examples in Groovy, and even consulted the official Groovy reference, but because it's not specific to Jira and I'm a novice with this kind of scripting, it left me a bit lost. I've seen lots of code examples in ScriptRunner and for Groovy that call classes (or whatever "import com.atassian.blah" etc etc are called), so there must be a reference, but I am baffled that Atlassian doesn't seem to have a reference listing for all those kinds of things.
I'm glad to know that it should theoretically be possible, though. Thank you for your answer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jon Jones
It should be something like this:
/* get the description */
def descriptionValue = issue.getDescription()
/* Check if your description contains the word you want
"valid" will be true if the word exist or false if the word does not exist */
def valid = descriptionValue.contains("the word you want to check")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.