Hi,
I am using the JMWE plugin to assign issues to a member of a certain role (QA) when a certain transition is executed (transition to "ready for testing"). Unfortunately, I can't influence which user the issue will be assigned to (it kind of uses the last user I added to the role....).
I now added Jira project automation: When issue is transitioned to "ready for testing" and has certain labels, assign a certain user. This seems to work, but AFTER the automation has run, the post function assigns the default QA user.
Can I make the post function run first and the automation run after?
Thanks!
Automation rules and workflow post-functions run in no particular order - they both run asynchronously and their execution order will depend on many factors such as how busy each app is (yes, Jira Automation is still technically an app, not built into Jira Cloud).
If you want a fixed execution order, you can create a "Sequence of post-functions" post-function and put both actions in the right order. But that means rewriting the Automation rule into a JMWE post-function, which is totally doable.
But in your particular case, you won't even need two post-functions, and thus you won't need a Sequence either.
The easiest is to use a Set Field Value post-function to set the Assignee field, and "calculate" the assignee using some simple script. For example:
{% if issue.fields.labels.includes("label1") %}
accountId:5af5eb7ef2f8f0082b775630 {# user John Doe #}
{% elif issue.fields.labels.includes("label2") %}
accountId:qm:cef55f50-2480-4e56-9307-ba35eb9598c9:c07cbb11-e3b5-4bb5-95de-38a353744b36 {#another user#}
{% else %}
{{'Developers' | roleMembers | first}} {# otherwise, assign to the first member of the Developers role #}
{% endif %}
To insert the accountId of a user, use the "Lookup user..." button in the editor toolbar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Fischer I think you missed a small call out here. I can't speak to all of the JMWE postfunctions, yet some number of them (if not all) have delay execution in seconds at the bottom and I have found them immensely helpful. Combined with the order by moving up or down as the response below addressed, it took a lot of testing but I was able to get in the same workflow transition 'create issue' 'email' and 'comment' to work properly together. Without delay in the create issue I would be in trouble. Even staggering a diff of 4 to 8 seconds, the execution accuracy success went from 50% to nearly 100%. So I bumped it to >10s and been lucky no issues for what I was looking to achieve.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
actually, you don't need to use Delayed execution to control the execution order of JMWE post functions. You can put them in a "Sequence of post-functions" post-function, which will force them to run one after the other. However, this only works between JMWE post-functions - you cannot include non-JMWE post-functions in a Sequence, and of course you can't control the execution order with Jira Automation rules...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Doreen Müller ,
in the post function list in the workflow edit page, you have the option to move the action up and down the list, which would change the order in which they are fired..
it should most probably solve your purpose.. be careful of the indexing option on it though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answer. The post function to assign a user is on first position already (and I want it to be executed first, at least before the project automation takes effect). So I think I can't help it by changing the position.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.