I am using the script runner Mail Handler option to read the email and create issue or add comment. How I can add the code to add comment in my script.
def subject = message.getSubject() as String
def issue = ServiceUtils.findIssueObjectInString(subject)
if (issue) {
return
}
When issue find in in if statement then I needs to add comment. What needs to be in that to add comment?
Thanks
Hi Omprakash,
Insert the comment instead of the return. Something like this;
import com.atlassian.jira.issue.comments.CommentManager
def subject = message.getSubject() as String
def issue = ServiceUtils.findIssueObjectInString(subject)
def body = MailUtils.getBody(message)
ApplicationUser reporter = messageUserProcessor.getAuthorFromSender(message) ?: user
if (issue) {
def comment = subject + " - " + body
commentManager.create(issue, reporter, comment, false)
}
If someone knows how to include e-mail sent date, I'd love to hear about it :)
@Bobone last thing how do we set reporter value to one of Text single line custom field ? I need to set this on create for one of custom field. Like "reporter" needs to update in "Contact Name"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omprakash,
Maybe this helps; https://community.atlassian.com/t5/Jira-questions/How-to-set-custom-field-in-incoming-mail-handler-in-sciptrunner/qaq-p/1127785
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do we get incoming mail handler sender full name? do we have some thing like
Message. RecipientType
.FROM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.