Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Validator - Assignee cannot be in a Project Role

KJ
Contributor
September 28, 2022

I am in Jira Cloud.

BLUF - How can I prevent assigning to someone in a specific project role?

I have a workflow where we need to change the assignee at certain transitions. On one transition, we assign the issue to a Project Role. That assignee can be updated while it is in that status, but we want to ensure that when it transitions to another status, that assignee is not in that Project Role. 

Here is how it should work

1. Issue transitions to Ready to Testing - post function assigns it to QA Lead role

2. QA Lead may or may not update the assignee while in that status

3. When transitioning to Validation, we want to make sure the issue is not still assigned to QA Lead and that the assignee is not the same as the user in the Developer field. 

I can configure that assignee != Developer. It's the project role validation that is flummoxing me. How can I invert the project role validator. 

We have both JMWE and Scriptrunner. 

I have tried the JMWE User Validator:

User(s) to check - User in field - Assignee

Mode - User(s) must meet: all the criteria below

Condition for user(s)

issue.assignee.accountId != issue.customfield_10208.accountId && !user.getProjectRoles(project).map(p => p.name).includes("QA Lead")

I think the second part of this is checking the current user rather than the assignee as it allows me to assign it to the QA Lead. 

 

1 answer

1 accepted

0 votes
Answer accepted
KJ
Contributor
October 26, 2022

I figured this out and thought I would post the solution here in case anyone else is struggling with this. 

Validator:  User Validator (JMWE app)

User(s) to check - User in field - Assignee

Mode - User(s) must meet: all the criteria below

Condition for user(s) - 

!(issue.assignee.getProjectRoles(issue.project).some(pr => pr.id == 10125))

I was able to get it to work with the ID of the role rather than the name. 

I hope this helps someone else.  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events