Have anyone tried to use the new post-function from JIRA Misc Workflow Extension plugin. I can't seem to get any of the groovy scripts to work. A simple example how to get a custom field value and put it in comment would be nice :)
Have you first tried putting a constant in the comment as a groovy script (e.g. "I'm here" - with the quotes)?
If that works, the you can move on to more complex Groovy. For example, getting a field value is as simple as:
issue.get("customfield_12345")
assuming 12345 is the numerical ID of your custom field (you could also use the string ID of standard fields, such as "reporter").
Note that if your custom field is not a text field, you might need to extract the actual string value. For example, for a select field:
issue.get("customfield_12345").getValue()
Hi David,
I've tried every option. When I type a costant string it works. But when a try to get a value from a field, there is no result. There are no ERRORs in jira log either. I've also tried both options below (used separately), but still no comment was generated.
issue.get("Summary").getValue() issue.get("Summary")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I found the problem.
For tests I've created a post-function to comment with groovy and after it I had the comment post-function with simple text in it. And it seems that the second one was overwriting the result of the first one. When I deleted the second one everything worked like you wrote in the first answer :).
I don't know if this should work like this, but thanks for your Help David :D.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad you found the problem. And, yes, you can create only one comment per transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Jira 6.1 and JMWE we have the following as a groovy expression for the comment
def msg = 'Resolved ' + issue.key return msg
which fails to add a comment. We also tried just a string
'Resolved ' + issue.key
also fails. But this
'Resolved '
works. We also tried issue.getKey() and issue.get('key') all failed. How does one get the issue key? How does one get that inserted into a comment?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue.get('issuekey')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was strugling to print a combination of text and values such as "<issue key> resolved" but found the following working using "+" between each in the linked comment from the Misc Workflow
issue.get('issuekey')+" resolved"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to use the technical field ID, which for Summary is, I believe, "summary" (lowercase s).
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.