I am building a change approval workflow that requires a variable number of approvers on any given issue. The user will manually enter the required approvers and an "Approve" transition is available only to users listed in that field. Once each approver has provided their approval, they are added to an "Approved By" list.
Using Scriptrunner, I want to compare the values of two custom fields that have multiple users listed, then fast track the issue through a certain transition when the values of the fields are the same.
I tried creating a fast-tracking listener with the following condition. It's not showing any errors or failures, however it's also not fast tracking to the next status.
cfValues["Approvers"] == cfValues["Approved By"]
Try treating your values as lists explicitly and using the groovy .equals function to compare the lists.
def
cField1 = customFieldManager.getCustomFieldObjectByName(
"Approvers"
)
def
list1 = issue.getCustomFieldValue(cField1) ?: []
def
cField2 = customFieldManager.getCustomFieldObjectByName(
"Approved By"
)
def
list2 = issue.getCustomFieldValue(cField2) ?: []
list1.equals(list2)
Also try
cfValues["Approvers"].values().equals(cfValues["Approved By"].values())
I'm less sure of this option without testing it on a server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.