I am writing a listener to create an issue. I would like throw the errors on to the jira UI.
I am trying something like below
IssueService.CreateValidationResult createValidationResult = issueService.validateCreate(currentUser, issueInputParameters)
log.error("Validation?: {}" +createValidationResult.isValid())
log.error(createValidationResult.getErrorCollection())
if (createValidationResult.isValid())
{
log.error("entrou no createValidationResult")
IssueService.IssueResult createResult = issueService.create(currentUser, createValidationResult)
if (!createResult.isValid())
{
log.error(createResult.getErrorCollection())
log.error("Error while creating the issue.")
def errorCollection=createResult.getErrorCollection().getErrors().values();
for (String error: errorCollection){
log.debug("inside error collection" +error)
UserMessageUtil.error("Error : ")
}
}
}
It is throwing error,but it is happening twice. ANy idea why is it so
I guess there are two entries in Error Collection?
Do you know how to check that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for (String error: errorCollection){
log.debug("inside error collection" +error)
UserMessageUtil.error("Error : ")
}
if this code is being executed twice, then you have 2 items in the collection.
Simply concat them and run the UserMessageUtil after the for loop closes.
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.