Jira Automation: How to add new approvers without writing over the existing ones
Asked by Ashley Honeycutt:

In Jira Service Management, I have a project that needs approvers from different departments. Each department approver is based on a different field value so I was hoping to create a rule for each unique department, instead of having one giant rule that accounts for each possible combination of departments/field values.

**For example**,

* *Approver 1 Criteria* (Finance Approver):
  * if the Cost \> $100, the approver from the finance department will be Person1.
  * if the Cost is \<$100, finance approver will be Person2.
* *Approver 2 Criteria* (HR Approver):
  * if the work is to take place in Region1, the HR approver will be Person3
  * if the work takes place in Region2, the HR approver will be Person4.

If I create these as two separate rules, the second rule overwrites the first value, but I don't want that. We need both people to approve. I see that Jira Cloud offers the option to check a box to have the subsequent rules run so they add the value *in addition to* the existing ones, but I don't see that in Data Center.

Thank you!


Answers:
author: Bill Sheboy
body: Hi [@Ashley Honeycutt](/t5/user/viewprofilepage/user-id/5065838)

Without seeing your complete rule(s)...

I hypothesize you are using the Edit Issue action and selecting the Approvers field from the dropdown list to set the value. With the multiple rules triggering, the last one will "win" to set the value.

Instead, please remove the Approvers field from the dropdown and use JSON to add the new value. For example:

```
{
  "update": {
    "Approvers" : [
      {
        "add": {
          "name": "user to add"
        }
      }
    ]
  }
}
```

Please look here to learn about updates with JSON in rules: <https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html>

Kind regards,  
Bill


author: Carla Ann Rowland
body: [@Ashley Honeycutt](/t5/user/viewprofilepage/user-id/5065838) I empathize with your question; I ran into similar scenario in data center. If you have an add on tool that allows scripting you could have an automation rule that calls Scriptrunner code because a Behavior would be a good tool here. (I don't for for Adaptavist.)

Question: how is the dollar amount entered on the jira issue? text field and how do you know it is above or below 100?

The simplest way I think to handle it without having to code or have a special add on like Adaptavist ScriptRunner is have it handled by the workflow in combination to your automation rules--- approval 1 is the appropriate approver based on dollar amount.

The automation rule moves it to "Approval 2" status --- where based on Region---appropriate approver is assigned.

If you don't want to have a separate status in your workflow setup a special transition that loops back to approval status--call it "Approval 2 loop". Modify your approver2 rule that it is triggered when your issue is transitioned using "Approval 2 loop" it assigns the appropriate approver based on your region criteria and it can be called by other automation rules.

I purposely did not put the reassignment of the HR approvers inside the transition because I don't know the scope of criteria you have to deal with.

I will check back on your ticket in a day or so--I have work stuff keeping me away from community for next few days.


Tags: data-center

jira-data-center

jira-service-management

jira-service-management-server

server