Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA JMWE - Set field value (JMWE app) based on summary value

I am working with JMWE and trying to write a groovy script where I want to check whether the summary of a ticket contains a specific string and then assign a ticket to a specified user if it does.

For example:

if (issue.get("summary").toLowerCase().contains("Check Refund")) { 'user1'}
if (issue.get("summary").toLowerCase().contains("Vendor Credit Memo")) { 'user1'}
if (issue.get("summary").toLowerCase().contains("Credit and Rebill")) { 'user1'}
else { 'user2'}

Is there a way to make this work? I am putting this post function on the 'create' workflow transition. I am also wondering if there is a functional wildcard to place within the quotes to parse any instance of the string, such as ("*Check Refund*").

1 answer

1 accepted

3 votes
Answer accepted

Hi Josh,

yes, this can work. However, there are two problems with your code:

  1. you are comparing a lowercase version of the summary with a constant string that contains uppercase characters (e.g. "Check Refund"). That will never match
  2. You must return the value, to stop further execution of the script

A fixed version of the script would be:

if (issue.get("summary").toLowerCase().contains("check refund")) {return 'user1'}
if (issue.get("summary").toLowerCase().contains("vendor credit memo")) {return 'user1'}
if (issue.get("summary").toLowerCase().contains("credit and rebill")) {return 'user1'}
return 'user2'

Thanks, David!

This checks out when I test the groovy script to an existing ticket.

 

What I should have mentioned in the original post is that my goal for this post function was to take a ticket that is created by an email handler and assign it based on what the summary contains. Do you know if this is possible?

Hi Josh,

it is very unlikely that the email handler can skip the Create transition. That's the only way to create issues in Jira. Can you double-check?

Hi David,

Brilliant! Upon further testing, I was still having issues - this was due to another post function counteracting the revised logic that we just discussed up above. Once that was removed, everything appears to be working just great!

Thank you for your help!

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you