Hi everyone,
Nice to e-meet you all.
I'm having issues with a specific post-function(Clone an issue and link), I'm trying to create a issue link it to the original and have make it have a specific description and assignee.
There is a condition in place to not execute this in case some of the required variables are not filled in.
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.user.util.UserManager
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.security.Permissions;
import com.atlassian.jira.event.type.EventDispatchOption;
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
userManager = (UserManager) ComponentAccessor.getUserManager()
MutableIssue issue = issue
if (issue.getProjectObject().getKey() == 'OPS') {
def cf_2 = customFieldManager.getCustomFieldObjectByName('Deployment date PROD')
def cf_3 = customFieldManager.getCustomFieldObjectByName('Platform')
val_2 = issue.getCustomFieldValue(cf_2).toString().split(" ")[0]
val_3 = issue.getCustomFieldValue(cf_3).toString().split(" ")[0]
/*
if (cf_3 == 'Azure'){
User usera = userManager.getUser('azure.team');
issue.setAssignee(usera);
}
*/
issue.setSummary(val_2 + ' deployment to PROD ' + val_3 + ' ' + issue.getSummary())
}Everything seems to work as the output creates a ticket with for example:
2016-12-13 deployment to PROD Azure TESTCASE
I for the life of me can't get it to be assigned to the azure team however.
I've googled a few examples however I can't seem to find one that works for me, am I overseeing something?
Cheers for the help.