Dynamic role assignee and notification depending on value of a select box in a transition

Alain Reding December 4, 2020

Dear Community members,

I have the following problem to solve and I don't know quite how to do that:

I have a select box with the 4 values A / B / C / D, a transition T1 between the statuses S1 and S2 .

Depending on the value in my select box (A,B,C or D),  when T1 is transitioned, it  can be approved / assigned to  4 different roles and the users that are being notified differ as well. There should be only one transitioin action available on the screen.

Any ideas how that can be done?

Thank you and best regards

Alain

 

PS: I do have the JMWE add-on at my disposal

2 answers

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2020

You won't be able to implement this with out-of-the-box Jira. You'll need a third-party app such as JMWE (our app), JSU, ScriptRunner, etc.

With JMWE, you'll be able to implement this with very limited coding (a couple of lines of code inside point-and-click workflow extensions).

Alain Reding December 4, 2020

Dear David,

Thank you for your reply.

As mentioned in my post I do have JMWE, but I haven’t figured out how to implement it. Do you have any suggestion ?

Thanks a lot for your support 

Alain

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2020

Hi Alain,

I'm trying to understand your exact requirements. What do you mean by "it can be approved / assigned to  4 different roles"? Can you elaborate? Are you trying to assign the issue to one member of a role, the role being dependent on the value of the select field?

Alain Reding December 5, 2020

Hi David,

That's it. If the select field is A, then members of role 1 will be notified and only members of role 1 can transition , if the select field B members of role 2 will be notified and only members of role 2 can transition etc. 

Each role will have a default assignee

Hope that helps

Alain Reding December 5, 2020

I can make four different transitions from S1 to S2, but than I would have 4 transition buttons on the screen. That's what I want to avoid. I want only one button, let's say 'Approve', that will than automatically transition based on the value of the select field.

Maybe some hidden transitions not visible to the user but will be triggered based on the select field.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2020

Hi Alain,

I'm a little confused now. Let me try to rephrase the way I understand it now:

  • Based on the value of the select field, the T1 transition will only be available to members of a corresponding project role. For example, if field value == A, only members of project role "Role 1" will be able to trigger T1

However, I didn't get the "notification" part. Which notification? And when / by what is it sent?

If the notification is sent during the T1 transition, and just needs to go to a different set of people based on the select field, then here's how to achieve both goals:

  • To show the transition only to the right users, you can create a Scripted (Groovy) Condition on T1 with a script like:
def role
switch (issue.get("select field")) {
case "A":
role = "Role 1"; break;
 case "B":
role = "Role 2"; break;
//etc
}
return !role || currentUser.isInProjectRole(role, issue.get("project"))
  • To send a notification to the members of the right project role during T1, you can use an Email Issue post-function with the following script in the "users from script" option:
def role
switch (issue.get("select field")) {
case "A":
role = "Role 1"; break;
  case "B":
role = "Role 2"; break;
//etc
}
return role ? issue.get("project").getRoleMembers(role) : []
Alain Reding December 5, 2020

Screen Shot 2020-12-05 at 22.12.14.png

 

Maybe a drawing makes things clearer.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2020

Did you read my previous post?

As for your schema, the problem is that there is no notion of "role assignee" in Jira. You can only assign an issue to a single user. So I'm still confused with Wyatt you're trying to achieve. 

Maybe you can just comment on my previous summary of my understanding?

Alain Reding December 7, 2020

Hi David,

Maybe initially I was not very clear in my writing. Let me rephrase. The process I need to implement is an approval process which needs to be approved by different people depending on the value of the select box. So I imagine this requires 4 different transitions, here in the middle of the diagram, that after 'approval' go to the bottom status.

Without the select box , In JIRA core, users would have to choose one out of 4 transitions to trigger the correct approval process. I'd like to avoid having the user to choose which transition to trigger from the 4 but rather have that dealt with transparently. 

Your suggestion with the scripted groovy Condition could be a way to go.

You said here is no notion of "role assignee" in Jira.

Right, but in JMWE you this

Property key: defaultAssignee

Property value: contains a comma-separated list of entries in the form ProjectKey -> *RoleName

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2020

What you mentioned about JMWE is just a way to select one user when JMWE's "Assign to Role Member" post-function finds multiple users in the same project role. But generally you should not be using a project role that contains multiple members, as it makes it harder to understand what the post-function does. What the post-function does is assign the issue to a single user, since the Assignee field in Jira is a single-value field.

As for your approval needs, see my previous replies - you don't need to create multiple transitions, the same one will work and only be available to the appropriate users based on the value of your select field.

0 votes
Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2020

Hi @Alain Reding  I see that you are running on Server so you do not have the Cloud Automation at your fingertips. I looked further into this in the light of David's answer and I forgot that you can run a script with JMWE, that you already have.

HTH,
KGM

Alain Reding December 4, 2020

Thank you for your reply Kristjan.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events