Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

clone issue through a listener is not working when issue create from Email as anonymous user

Anunna Mandal October 21, 2020

Hi ,

We are trying to create issue by clone issue listener when the issue is created from Email.

but the cloning is only working when the issue is created from UI and not from mail because in our clone issue listener script we have the condition to authenticate the user with the logged in user  and when we check the log of issue created from mail it is showing anonymous creating the issue, which may be causing the script to not clone the issue as it is not true to the condition applied of the user.

log: 

2020-10-21 07:03:06,401-0400 INFO [Jira-Watchtower-IMAP] Caesium-1-2 anonymous Watchtower Issue Creation Watchtower Issue Creation[10207]: Issue WAT-398 created

Below is the condition part to create a clone issue:

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.user.ApplicationUser
import groovy.json.JsonSlurper
import com.atlassian.jira.issue.fields.CustomField
IssueService issueService = ComponentAccessor.getIssueService()IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();

issueInputParameters

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

IssueService.CreateValidationResult createValidationResult =
issueService.validateCreate(user, issueInputParameters)

if (createValidationResult.isValid())
{
log.debug("Passed Issue Creation Validation")
IssueService.IssueResult createResult = issueService.create(
user, createValidationResult)
if (!createResult.isValid())
{
log.error("Issue Creation Failed")
}
}

I have not posted the whole script,only the body of the script and the condition part in bold which i feel is causing the issue because of the application user  .How can we allow the issue cloning even if the issue created by any user (including anonymous user) .

Thanks & Regards,

Anunna

0 answers

Suggest an answer

Log in or Sign up to answer