Subject line in Script Runner Plugin - Send a custom email

Frank Stillone
Contributor
April 6, 2016

In the Subject section of the "Send a custom email" script, I have entered:

My Company Name | $issue.key has been processed | Resolution: $issue.resolution

The result is:

[JIRA] The Silent Partner | FPS-1 has been processed | Resolution: [id:10600, description:, sequence:35, name:Interested, iconurl:null]

My question is: I only want the resolution after "Resolution:". For example, I want it to look like this:

[JIRA] The Silent Partner | FPS-1 has been processed | Resolution: Interested

am I able to do this and how would I acheive this?

Thanks

Frank

 

1 answer

0 votes
Thanos Batagiannis [Adaptavist]
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.
April 6, 2016

Hi Frank,

In order to get only the name of the resolution use

$issue.resolution?.name - for a post function this will not work use <%=issue.resolution?.name %> instead

regards

Frank Stillone
Contributor
April 6, 2016

Thanks Thanon,

I have tested this but it does not seem to work. The result is:

Re: [JIRA] The Silent Partner | FPS-1 has been processed | Resolution: [id:10600, description:, sequence:35, name:Interested, iconurl:null]?.name

Any thoughts?

Thanks

Frank

 

Jozef Kotlár
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.
April 6, 2016

Did you try wrap the expression in curly braces? ${issue.resolution?.name}

Thanos Batagiannis [Adaptavist]
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.
April 6, 2016

yes, think it should be "wrapped" in curly braces, thanks Jozef.

Frank Stillone
Contributor
April 7, 2016

Thanks Jozef,

I have done that and the result is:

When I test in the workflow using the preview button, I get:

The Silent Partner | FPS-1 has been processed | Resolution: Interested

when I test by activating the workflow and sending an email I get:

[JIRA] The Silent Partner | FPS-1 has been processed | Resolution:

In other words, its dropping the value of the resolution, which should be "Interested".

Any thoughts?

Thanks

Frank

Frank Stillone
Contributor
April 7, 2016

Note that I have applied ${issue.resolution?.name} into both the subject and the body. The value is dropped in both instances

Thanos Batagiannis [Adaptavist]
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.
April 8, 2016

Hi Frank,

Try to use 

Resolution : &lt;%=issue.resolution?.name %&gt;

I will also update my original answer.

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.
April 10, 2016

You can't use this syntax ( ${issue.resolution?.name}) in workflows. JIRA tries to interpolate the value of it before the plugin gets to look at the script, which just buggers everything up.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events