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

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

Rihab BENYOUCEF September 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.
September 25, 2023

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