All, I have tried this several different ways, but it seems impossible, and I am having trouble understanding why. What I want is for new issues being automatically created based on emails to go through a couple of different scripted processing functions. For a simple example:
What I have tried so far is putting all of the above into post functions in transitions. This does not work. When I try to create an issue while 3b is implemented, if I manually create an issue which will match 2b, then I get this error message: "We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file." If I remove that one step, then everything else works fine. The issue I created will:
I have also tried taking 3b out, and making it an event listener. Instead what I do in step 3 above is modify the issue summary to include a flag to denote the issue needs to be removed. My reason for moving this to a listener was a guess that I could not a delete a thing as it was being created (which I am still not doing really, but whatever . . .). If I put it in a listener then I am saying okay, wait till this thing is created, transitioned, and the new issue cloned from it. THEN, listen for the last issue updated event, and then do the delete. Like this would be a completely separate, stand-alone task. However, I get the same message as above no matter what.
It seems that there is no way to automatically delete issues at least not when the chain of events leading to that starts from a series of automated actions initiated during the Create transition. Can anyone shed some light on this?
Sorry, I am using ScriptRunner, by the way. The listener is:
// ***************************************************** // ** Perform required imports // ***************************************************** import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.bc.issue.IssueService import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.security.JiraAuthenticationContext import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.user.util.UserManager import java.util.regex.Matcher import java.util.regex.Pattern import com.atlassian.jira.bc.issue.IssueService.CreateValidationResult import com.atlassian.jira.bc.issue.IssueService.DeleteValidationResult import com.atlassian.jira.bc.issue.IssueService.IssueResult import com.atlassian.jira.util.ErrorCollection // get all of the Managers you need (or core components) UserManager userMgr = ComponentAccessor.getUserManager(); UserManager userMgr = ComponentAccessor.getUserManager() IssueService issueSvc = ComponentAccessor.getIssueService() //Get an Issue Manager ApplicationUser svcUser = userMgr.getUserByName("svc-jira") IssueManager issueMgr = ComponentAccessor.getIssueManager() MutableIssue issue = issueMgr.getIssueObject(event.issue.getId()) Matcher deleter = issue.summary =~ /^REMOVE THIS ISSUE/ assert deleter instanceof Matcher // Check if this is an issue to be deleted if (deleter) { DeleteValidationResult delValidationResult = issueSvc.validateDelete(svcUser, issue?.id) log.error delValidationResult.isValid() if (delValidationResult.isValid()) { try { ErrorCollection deleteResult = issueSvc.delete(svcUser, delValidationResult, EventDispatchOption.ISSUE_UPDATED, false) log.error "The issue with ID " + issue.id + " and key " + issue.key + " has been deleted." } catch (e) { log.error e.toString() log.error e.getMessage() log.error e.getStackTrace() } } else { ErrorCollection errors = delValidationResult.getErrorCollection() log.error errors.getErrorMessages() log.error errors.getErrors() } }
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.