JMWE Validator - Verify that the Assignee is not being assigned as an approver (custom field).
To transfer to a following status, user is required to assign user's approver roles, user is not allowed to be in any of these roles.
Any advice?
Hi @Tyler Stephens ,
You can write scripted validator using JMWE for this:
you first check if the approvers field has a field, and then that the assignee is not in the value(s) of that same field.
The JMWE editor actually helps you a lot, so please try and play around with it to check for yourself.
For me, this would look something look this:
-> customfield_10003 is my 'approvers field', you can click on "issue fields" in the jmwe app and find your own id for the field
-> i first check if the field is not null with !!
-> I then check the value(s) in the field, and match the id of all values to the id of the assignee, it should not match to any
!!issue.customfield_10003 && !issue.customfield_10003.some(it => it.accountId == issue.assignee.accountId)
Hope this helps,
- Tessa
Hi Tessa,
I received the following error:
Evaluation failed: "issue.customfield_13743.some(it => it.accountId == issue.assignee.accountId)" - issue.customfield_13743.some (null) is not a function
that means that customfield_13743 is empty. In Tessa's example, there was this in front of the expression:
!!issue.customfield_10003 &&
You seem to have omitted it. Your expression should be:
!!issue.customfield_13743 && issue.customfield_13743.some(it => it.accountId == issue.assignee.accountId)
Hi @David Fischer
I used the full expression Tessa provided. Could the expression be affected due to the field being in a transition screen? My goal is for the validator to verify the field on this transition screen (customfield_13743 != the assignee).
It looks like you're new here. Sign in or register to get started.