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

Jira Automation remove a user from Approvers

alexander_cartlidge October 10, 2022

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

alexander_cartlidge October 11, 2022

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

Yogesh Mude April 27, 2023

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 1, 2023

@Yogesh Mude ,

Have you tried this?

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

Works fine for me.

Hope this helps 

Sanjivani Wayal July 24, 2023

@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.
July 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?

Sanjivani Wayal July 25, 2023

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?

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2023

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!

Sanjivani Wayal November 16, 2023

@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

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2023

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

Sanjivani Wayal November 16, 2023

@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

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2023

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