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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.