Subject line in Script Runner Plugin - Send a custom email

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

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

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

 

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

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

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

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

Hi Frank,

Try to use 

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

I will also update my original answer.

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

86 views 0 5
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