You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello Community,
I am currently writing a script for using the script mail handler for achieving the following use case.
As per what I have read in the documentations, it is possible to do so using the script mail handler in the incoming mail handler settings.
In the document it shows how to get the commits from 3rd party app like bitbucket etc.
But in my case it will be coming from email. Also, I am not sure how to set the comment author since the actual author will be a non jira user.
I managed to write the following code it does seem to be working. So far it does not give any errors.
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.mail.MailUtils
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.service.util.handler.MessageUserProcessor
CommentManager commentManager = ComponentAccessor.getCommentManager()
def messageUserProcessor = ComponentAccessor.getComponent(MessageUserProcessor)
def subject = message.getSubject() as String
def issue = ServiceUtils.findIssueObjectInString(subject)
def body = MailUtils.getBody(message)
def sender = messageUserProcessor.getAuthorFromSender(message) as String
if (issue) {
def comment = sender + subject + " - " + body
commentManager.create(issue, reporter, comment, false)
}
If anyone has worked in this before? It would be a big help.
Thanks in advance,
Pooja
You can get external reporter identity using following code:
// get email sender
def reporterEmail = ""
final List<String> senders = MailUtils.getSenders(message);
for (final String emailAddress : senders)
{
reporterEmail = emailAddress
}
However, use default user to create issues for non jira users. That will help to reduce number of licenses.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.