Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to Assign a Sub-Task to a Group Only When the Parent Issue's Assignee Is this Group User?

Edited
Rihab BENYOUCEF
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Sep 22, 2023

I've created a sub-task of type "Demande de modification" and developed a SIL script for a post-function. My goal is to assign the sub-task to Group only when the assignee of the parent issue belongs to Tthis Group . Here's my current code:

string subTaskKey = createIssue(project, key, "Demande de modification", "Demande de modification");
linkIssue(subTaskKey, key, "Relates");
if (%key%.assignee == "GroupeB"){
%subTaskKey%.assignee = "GroupeB";
}

 

However, the current code doesn't take into account whether the parent issue's assignee is from the Group . How can I modify the code to achieve this specific condition?

1 answer

2 votes
Anna Hryhoruk _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 25, 2023 • edited

Hello @Rihab BENYOUCEF ,

I can help you with a script to identify if the assignee of the parent issue belongs to a specific group, but I see another problem here, you wrote: "My goal is to assign the sub-task to Group".  Jira doesn`t allow the Assignee field to be a group, it should be a particular user, please check this Assign issues to multiple users or a group . 
Of course, using SIL script we can write any string value to the Assignee field (group name, list of names etc) , but it will not have any practical meaning, it will be just a string value stored inside the field. 
I found some sort of workaround for this, but it involves  creation an extra group picker field instead of the native "assignee", you can see more details here if you are interested:  Atlassian Support Documentation JIRA 6.4.x How do I assign issues to multiple users 

But coming back to your original problem: identify if the assignee of the parent issue belongs to a specific group.
you should replace if (%key%.assignee == "GroupeB"){
with smth like this: 
if(userInGroup("GroupeB", assignee)){
Here is some documentation about this routine userInGroup and some use case example Limit the assignee to a specific group 

Hope this helps!
Anna

Suggest an answer

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

Atlassian Community Events