Question about 'Send a Custom Email' post function

We have a multiselect custom field that is being used as part of the condition conrolling the Send a Custom Email post function. Here is what is in the condition

cfValues["Send to Logrequest"].toString() == "Yes"

What is needed is to be able to reset this custom field to "No" or none after the email is sent. Adding the 'Clear Field Value' post function from the JIRA Suite Utilities plugin results in no email. Also tried the 'Set Field Value to constant or Groovy expression' from the JIRA Misc Workflow Extensions pluginwith the same result of no email being sent. And out of desperation added

<% cfValues["Send to Logrequest"] = null %>

to the end of the message template. Still no email.

A general question about post functions. Are they executed in the order displayed? Or some other order?

Any idea how to accomplish this? Thanks in advance.

1 answer

1 accepted

0 votes
Accepted answer

Check the order of post function execution.

Send custom email post function should executed before clear field value.

So if clear field value is executed first no email is sent.

You can change the order of post functions by click on the arrows. Check the screenshot below.

Hope that helps

The Send a Custom Email post function appears ahead of any of the other post functions that try to clear/reset the custom field.

Possibly your condition is wrong

try the following

cfValues['Send To Logrequest']*.value.contains('Yes')

The Send Email post functions *works* if the post function that tries to set/clear the custom field is removed. This has always been the case. It is as if the post functions are being excuted in parrallel or out of order.

Just reproduced it. You are right. Doesn't work if clear field value post function is used. No idea why this happens...

Hopefully, Mr. Eichlin will have some insight.

You could try a god-awful hacky workaround. Immediately fter the send email function, add a custom script post-function, which just contains:


obviously this will delay the transition by half a second, but it should work.

Kostas is right on the condition script... it might work for you but it will also return true if the select contains something like "goldeneyes" - case notwithstanding.

It's because the send mail function starts a new thread, then pauses and sends the mail, to deal with a jira bug:

But your use case is valid, create an issue so you can track when it's done and I'll deal with it. But it will go in to the next major version... I'm not backporting anything at the moment.

Is there any other workaround available? I have the same issue with a script that alters the comment AFTER the custom email is sent. As the email uses the comment initially I need to keep the original comment with the sleep(700) before I alter it

Hi i also had a similar problem but fixed it with the following function in scriptrunner:

  • Copy the email body to another customfield and the straight after clear the orginal customfield value. 


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,637 views 18 21
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