Hello Community,
I'm trying to configure automation to set a field called "Approvers" (multi-user picker) but then add a condition that IF one of the approvers is the initiator --> remove their name/email as one of the approvers from the field.
One of my customers would like this as a safeguard so that if one of the approvers IS the ticket creator, they cannot self-approve their own request.
Screenshots of automation configuration below:
Note: in screenshots I changed the "create issue" trigger to "field value change" for ease of testing.
Everything seems to be ok until I get to the 2nd "Edit issue field (Advanced)". I've tried several variations but get errors every time.
Any help truly appreciated.
Thank you very much and Kind Regards,
Amed
When you are adding/removing a user from a user picker field you have to use the Atlassian Id, and that is why you get the Token is empty error. The advanced edit should look something like this:
Hi Mikael,
Thanks so much for the help and response but it did not work. This time, no error, success but did not actually remove the initiator. When I use accountId in condition, it does not pass the condition, I used emailAddress in condition so it passes and then your config in advanced but not expected result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the approvers field a user picker field or a text field? Based on your log it makes me thing that you are using a text field, because if you are using a user picker field {{issue.approvers}} should give you the Atlassian Id instead of the email address.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, wait, I just noticed that you are on server. So try this in the advanced edit:
{ "update": { "approvers": [ { "remove": "{{initiator}}" } ] } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, try this:
{"update": {"approvers": [{"remove": {"name":"{{initiator}}"}}]}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It worked!!! :)
However, I do have a strange behavior I was wondering you can help me figure out. This has happened to me with automations before. Not sure if it's a Server/Data Center quirk.
I have to run the automation twice. The first run will fill the value of both approvers ( I can see this in the ticket) but the proceeding log in automation does not pick up the value and the condition to check "if initiator is in the approvers field" will return false (seen in screenshot 1).
When I run it again (with value of field populated with both users already), it runs successfully and removes the initiator but the last log at bottom of automation does not indicate the removal, still shows both users (seen in screenshot 2).
It's as if the automation is running too quickly to detect its own changes. Have you every seen this behavior or is there an adjustment I can make to the automation rule to prevent this?
Thanks
Screenshots below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is expected, the automation only have access to the data in the issue at the time it was triggered. You can add the Re-fetch issue data after the edit of approvers and that should solve the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for all the help with this Mikael. All working as expected now.
One last thing, if you don't mind sharing some wisdom. How does one become so masterful in automation? Just years of grinding and experience and over time, it comes? Any recommendations on how to improve in this respect? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Haha, for me it has just been grinding and experience ever since we started using JSM 2+ years ago. Automations are now a big part of it and we keep coming up with new use cases all the time.
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.