Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Jira Automation remove a user from Approvers

Hi All,

I am trying to use the Jira automation to edit a multi user picker field. We use Jira Service management and what I would like to do when an issue is updated by a certain member, then a specific user is removed from the Approvers field. I've tried different variations of JSON code but I can't get anything to work.  I'Ve looked through the commmunity posts of this and although there seems to be some solutions none are working for me.

Solved: Jira Automation - Edit issue multi user picker fie... (atlassian.com)

Remove "Request Participants" using Automation rul... (atlassian.com)

If anyone could help me it would be much appreciated.

 

thanks in advance.

 

Alex.

1 answer

1 accepted

4 votes
Answer accepted
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 10, 2022

@alexander_cartlidge , this is working for me

 

{
"update": {
"approvers" : [
{
"remove": {
"id":"user_id"
}
}
]
}
}

Can you try this in your automation rule and share the screenshot of your audit log automation? If you could share your complete automation rule, I think can help us to understand better your rule structure.

Let me know if you have questions 

Hi Fernando,

Thanks for the quick reply. Unfortunately no it doesn't work for me. However if I substitute the "user_id" for "name" and use a custom field smart value I can get it to work. The customfield is populated with a post function upon issue creation and then I can use that.

{
"update": {
"Approvers": [
{
"remove": { "name": "{{Delegate Approver.name}}" }
}
]
}
}
}

 

So this will solve half the problem. Thanks for pointing me in the right direction. What the rule should do is remove 1 of the 2 approving Managers when the 1 Manager approves the request / Issue.

The problem I have now is the fact that an approval does not trigger an update to the issue. So although I have a working rule I have no trigger to make the rule run. If you have an idea about that one. I'm all ears :)

Kind regards

Alex.

Like John Funk likes this
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 11, 2022

@alexander_cartlidge 

Glad to know that it worked for you!

If you don't have the "Approval Completed" trigger on your automation, then you can use the "Issue Transitioned" event to execute your rule.

Considering that when Manager 1 approves, jira will transition the Issue to another status, I believe this trigger will help you with that.

Hello @Fernando Eugênio da Silva ,

I have multiple users in the Approvers field and want to remove the one who triggered it.

Even tho I used the initiator.accountId still it's removing the other users as well.  

Any assistance will be appreciated.

Thank you in advance. 

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 01, 2023

@Yogesh Mude ,

Have you tried this?

{
"update": {
"approvers" : [
{
"remove": {
"id":"{{initiator}}"
}
}
]
}
}

Works fine for me.

Hope this helps 

@Fernando Eugênio da Silva  i have tried this with my automation but it is giving me error in Audit log 

(Specify a valid value for customfield_XXX (customfield_XXX))

 

{
"update": {
"Approval1" : [
{
"remove": {
"id":"{{Approved2}}"
}
}
]
}
}

 

Could you please help 

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 25, 2023

@Sanjivani Wayal 

Could you share your audit log error?

 

Also, the value 'approved2' is a customfield Picker User or is the user initiator of one second step approval?

Hi @Fernando Eugênio da Silva 

 

I was able to get this using below code 

{
"update": {
"app2": [
{{#issue.aap1}}{"remove": {"id":"{{accountId}}"}}{{^last}},{{/}}{{/}}
]
}
}

 

Now iam struggling with is if i remove value from app1 it should get added back to app2 tried to use same code with add instead of remove but it adds the value which is in app1,

Any idea how can i get this?

Hi,

I am also facing the same issue, that I cannot either add or remove a user from multi user custom field. 


I am using 

Remove:


{
"update": {
"customfield_12345": [{
"remove": {"id":"{{1585625}}"}
}]
}
}

 

Add:
{
"update": {
"customfield_12345": [{
"add": {"id":"{{1585625}}"}
}]
}
}

Is there something wrong in above, am I missing soemthing?

Thanks!

@Harsh i used -

to remove -

{
"update": {
"Pending Approval": [
{{#issue.Already Approved}}{"remove": {"id":"{{accountId}}"}}{{^last}},{{/}}{{/}}

]
}
}

To Add -

 

{
"update": {
"Pending Approval": [
{{#issue.Already Approved}}{"add": {"id":"{{deletedFieldChange.values}}"}}{{^last}},{{/}}{{/}}

]
}
}

it works for me

Hi @Sanjivani Wayal 

 

Thanks for the response

If I understand correctly 

- Pending Approval is the field you are changing and I assume we can use as - customfield_123

-{{#issue.Already Approved}} what is this? 

 

So to give a background - what I am trying to achieve is when the value changes for a field I want my user field (multi user) to be updated and remove with users accordingly .

 

If you have any idea how to achieve this that would be great. 

Thanks

@Harsh I had 3 fields 

1) Approver

2) pending Approver

3) Already Approved

firstly all the users were added in approver same names would get added in Pending Approver (automation to add) 

Then as and when users would add there name in already approved the names would get removed from pending approver 

Hope that answers your question

Hi @Sanjivani Wayal 

Thanks for the update.

 

Do you have idea how I can achieve the below 

So to give a background - what I am trying to achieve is when the issue is created or updated.

 

Example-

If component= A(on creation or edit action)

Then multi user field should be updated to user A and user B

If at any point of time component A is removed then remove the above user. 

Is this achievable. ?

I tried your json and edited but no luck. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events