ScriptRunner - create email for custom field

Richard Jones July 27, 2015

Hi all

I've got script runner installed and have a custom field called reviewer. When reviewer is set then I would like an email sent to that person (much like what is sent if you are assigned a JIRA)

The reviewer field is of type "User Picker (single user)"

Is it possible to send an email to this selected person. At the moment i can easily see how to map the user to the user's email address on their profile? Is this possible?

Thanks


image2015-7-27 17:22:59.png




EDIT:

Thanks to @Jamie Echlin [Adaptavist] for the help so far. I still dont get any emails though. See my configuration


image2015-7-28 21:52:22.png

2 answers

3 votes
JamieA
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.
July 27, 2015

You should be able to use the custom field ID, as it says in the text underneath the field.

So eg: customfield_10020 should work fine.

But your condition is wrong, try 

cfValues["reviewer"]

Note that case is important, so check if it's Reviewer or review... also you have typo'd the field name. 

Richard Jones July 27, 2015

Thanks Jamie Echlin How do I get the customer field id. From the URL I can see things like customFieldId=10311 so i used customField_10311 (removing the = and the Id) For the condition I can search within JIRA with just the Reviewer field but I see from your example I have to use cfValues[....]. Im using "cfValues['Reviewer'] is not null" which hopefully will work Thanks for your help!

Anton Haglund July 27, 2015
Richard Jones July 27, 2015

thanks @Anton Haglund . The id field I found was the correct one

Richard Jones July 27, 2015

Hi @Jamie Echlin [Adaptavist] . I tried cfValues['Reviewer'] is not null and various other combinations but none worked. Is there some other trick I need here? Thanks

JamieA
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.
July 28, 2015

for the "to issue fields" use: customfield_12345 be careful of the case, earlier you wrote customField. Try that without a condition, if that works we can work on the condition.

Richard Jones July 28, 2015

Thanks @Jamie Echlin [Adaptavist] I did have the wrong case but still dont get the emails :(. I have updated the question with a screenshot. Ive tried to put in my email address directly but still dont see it. Also is there a away to put the link to the JIRA in the email subject or mesage?

0 votes
Kathy Tempesta July 29, 2015

I have a similar workflow but I took a low-tech approach. I added a transition to all the relevant steps called "Add <role>" and created an event called "<role> assigned" that I added to my notification scheme. I also removed the <role> field from the edit issue screen to the transition is the only way to get to it. 

Suggest an answer

Log in or Sign up to answer