Basically what I need is below
I have a custom field 'Special' with values None, A and B as drop-down option. By default the option is set as NONE. A user could change option A or B. When someone choses a value to A or B, an email needs to be send out accoridngly to a fixed email chain.
Need to send out Issue ID and Summary for the issue in the email as well as the current user who set it.
How can I accomplish this?
I tired behaviour plugin as described in this post and also used Mizan's option but think I am don't have the requisite background to code this. Apreciate any help
https://answers.atlassian.com/questions/67193/send-e-mail-notification-after-editing-a-specific-custom-field-in-issue-edit-screen
import com.onresolve.jira.groovy.user.FieldBehaviours import com.onresolve.jira.groovy.user.FormField import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.Issue import com.atlassian.mail.Email import com.atlassian.mail.server.MailServerManager import com.atlassian.mail.server.SMTPMailServer import org.apache.log4j.Category FormField Special= getFieldById('11240') ComponentManager componentManager = ComponentManager.getInstance() MailServerManager mailServerManager = componentManager.getMailServerManager() SMTPMailServer mailServer = mailServerManager.getDefaultSMTPMailServer() if (mailServer) { Email email = new Email("someuser@example.com") // Set the TO address, optionally CC and BCC email.setSubject("Blocking issue raised by ${issue.getReporter().getFullName()}: ${issue.summary}") // todo: check the subject value String content = "Construct your body here."; //TODO: Set email's body. email.setBody(content) mailServer.send(email) } else { log.error("No SMTP mail server defined") }
Hi Rizwan ,
Use the exact script provided by me .. use fieldChanged instead of your customfield id .
Also the script is for an older version of Jira , there are some api changes which you will need to update . eg: ComponentManager -> ComponentAccessor .
IF you use the above script then it will send an email whenever the user changes the value of the field before submiting it . I think you should use a post function , may be you can use send custom email post function by script runner plugin
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.