Depend upon the select list Value the assignee of subtask has to change

Kumar
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.
October 13, 2019

Hi Team,

I have a select list field 

select list : optionsA, optionB and optionC

now when the user create a story if he select the select list value “OptionC” so now if the story has any subtask those all subtask assignee has to change to Reporter of the Story(parent issue).

 

Could you please help how to resolve this issue.

 

Thanks,

Kumar

 

 

2 answers

2 accepted

0 votes
Answer accepted
fran garcia gomera
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.
October 14, 2019

ok, you will need a postfunction in the creation of the subtask. 

Think this should work, maybe you need somefine tuning

import com.atlassian.core.util.DateUtils
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import java.sql.Timestamp;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.MutableIssue

def issueManager = ComponentAccessor.getIssueManager()

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def changeHolder = new DefaultIssueChangeHolder()

def parentissue = issue.getParentObject()

def cf = customFieldManager.getCustomFieldObjects(parentissue)?.find { it.name == "your_fieldname" }

if (parentissue.getCustomFieldValue(cf).toString()=='option C'){
log.warn parentissue.getReporter()
issue.setAssignee(parentissue.getReporter())
issue.store()
}
Kumar
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.
October 14, 2019

@fran garcia gomera  So we have to add this script in the Subtask workflow Create transition right???

I will work around with the script and I’ll do let you know if I have any issues and Thanks you so much for your script.

 

 

Thanks,

kumar

fran garcia gomera
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.
October 14, 2019

So we have to add this script in the Subtask workflow Create transition right???

Right

Thanks,

you're welcome. 

0 votes
Answer accepted
fran garcia gomera
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.
October 14, 2019

do you have automation or scriptrunner?

It can be done with any of those plugins. let me know if you use any of them and maybe i can give you some lead

Kumar
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.
October 14, 2019

Hello @fran garcia gomera     Thanks for your response we do have script runner for jira plugin 

Could you please help me with the script 

 

Thanks

phanidhar

fran garcia gomera
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.
October 14, 2019

Question: how does the parent issue linked subtasks before creation? or you want that change to be triggered whenever the select field is changed to option C?

Kumar
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.
October 14, 2019

I will give an example

 

Now when the user created a Story if he select the “optionC” select list value while creating or after creating now if they create any subtask after creating the Story those linked subtask assignee has to chance to reporter of the Story automatically.

 

if the Story does not have any linked subtask then we don’t require any automation changing assignee

 

If you did not understand the example please do let me know I will explain more detail.

 

Thanks,

kunar

Suggest an answer

Log in or Sign up to answer