Hi there,
We need to change this script. Now it creates sub-tasks, we need to change it to standard issue-type, with "connects" link type.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
def lstCmp = issue.components.name
def cfRIA = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("YYYYY")
Collection<ApplicationUser> users= (Collection) issue.getCustomFieldValue(cfRIA);
if(users != null && lstCmp.contains("testtest"))
{
for(i in 0..users.size()-1)
{
Object AssigneeValue = "Mr.Test";
issueObject = ComponentAccessor.getIssueFactory().getIssue()
issueObject.setProjectObject(issue.getProjectObject())
issueObject.setIssueTypeId("XXXXX")
issueObject.setParentId(issue.getId())
issueObject.setReporter(issue.getReporter())
issueObject.setSummary(issue.getSummary() + ' ' + users.get(i).getValue())
issueObject.setAssigneeId(AssigneeValue)
issueObject.setDescription(issue.getDescription())
def issueManager = ComponentAccessor.getIssueManager()
def subTask = issueManager.createIssueObject(ComponentAccessor.jiraAuthenticationContext.getLoggedInUser(), issueObject)
ComponentAccessor.subTaskManager.createSubTaskIssueLink(issue, subTask, ComponentAccessor.jiraAuthenticationContext.getLoggedInUser())
i++
}
}
Thanks in advance.
Ok, the easy bit is obviously just to change the "set issue type id" to create an issue instead of a sub-task type.
Then instead of the sub-task linking, you can have a look through https://library.adaptavist.com/entity/add-or-update-the-issue-link-for-an-issue-in-jira to see how to work with issue-links.
Thanks a lot, could you please correct my code and paste it again. It would be great.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.