Send a custom email - Error

I performed several tests on appeal "Send a custom email" in "Script Runner Builtin" it works for viewing and sending email. But when I insert the script in "Post-Function" in Transition "Create Issue" it does not send e-mail and returns no error.

Here are the codes used

Condition: ['Blocker']. Contains (issue.priority '. Name)

Email template: The $ $ issue.issueType.name issue.key was created with priority <% Out << issue.priority '. Name%>. <br>

Summary: $ {} issue.summary <br>

Responsible: $ {issue.assignee '. Name}

Subject template: The Bug Blocker: $ issue was created | DISCLAIMER |

Email format: HTML

To addresses: e-mail address

What could be wrong?

3 answers

1 accepted

0 vote

I think you will need to change it so that:

$issue.issueType.name $issue.key

looks like:

<% out << issue.issueType.name < " " < issue.key %>

That is, for what you've done with the priority do the same with the other fields.

The problem is that OSWorkflow tries to be clever and converts any args with a $ in to a field and substitutes a null.

O &lt;% out &lt;&lt; issue.issueType.name &lt; " " &lt; issue.key %&gt; foi criado com a prioridade &lt;% out &lt;&lt; issue.priority?.name %&gt;. &lt;br&gt;
Resumo: ${issue.summary} &lt;br&gt;
Responsável: ${issue.assignee?.name}

Jamie,

Now is giving syntax error

You still haven't changed the last two lines. Use the email test in Admin -> Built-in scripts. Build it up step by step starting from something that works.

Condition:
['Closed'].contains(issue.status?.name)

Email template:
A ${issue.key} foi finalizada. &lt;br&gt;
Resumo: ${issue.summary} &lt;br&gt;
Responsável: ${issue.assignee?.name}

I tested this in another post of Transition Functions: Close Issue and neither worked.
Below the screens of Builtin Script Runner (that works and even sends e-mail) and the code in Post Functions (which does not work and does not send e-mail).

0 vote
Henning Tietgens Community Champion Mar 19, 2013

Could you copy & paste your code to a code block using the code icon of the editing area? It looks a little bit messed up in the current way.

Henning

O $issue.issueType.name $issue.key foi criado com a prioridade &lt;% out &lt;&lt; issue.priority?.name %&gt;. &lt;br&gt;
Resumo: ${issue.summary} &lt;br&gt;
Responsável: ${issue.assignee?.name}

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...

355 views 0 6
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