Comment issue in JIRA Misc Workflow Extension

Ireneusz Lepel March 12, 2014

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 :)

2 answers

1 accepted

1 vote
Answer accepted
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2014

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()

Ireneusz Lepel March 12, 2014

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")

Ireneusz Lepel March 13, 2014

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.

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2014

Glad you found the problem. And, yes, you can create only one comment per transition.

Daniel Ehrlich May 7, 2014

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.

David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2014
issue.get('issuekey')

stephane leroy May 20, 2016

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"

1 vote
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2014

You need to use the technical field ID, which for Summary is, I believe, "summary" (lowercase s).

See https://docs.atlassian.com/jira/4.0/constant-values.html#com.atlassian.jira.jelly.tag.issue.AbstractCreateIssue.KEY_FIX_VERSIONS

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events