Comment issue in JIRA Misc Workflow Extension

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

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

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.

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

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.

issue.get('issuekey')

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 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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

830 views 2 9
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you