Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

Thank you for your reply Kristjan.

0 votes

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).

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

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?

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

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.

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) : []

Screen Shot 2020-12-05 at 22.12.14.png

 

Maybe a drawing makes things clearer.

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?

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

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.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
Community showcase
Published in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

120 views 7 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you