Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Update multi select field based from email body


Can someone can help me on how to update multi select field based from the email body using scriptrunner email handler?

Jira data center

Vetrical field is multi select field


Email body

final String body = """This is a test body

Vertical: [ "option1","option2"]

Description: sample description



Appreciate your help on this

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2022

This is a script which is generally useless because it's a composite example - it shows you how to set a value of every type of standard custom field.

You should be able to extract the bits that refer to multi-selects quite easily

Hi @Nic Brough -Adaptavist- 


I've already tried that one but I'm not sure how to pass the variable to select option.



Here's my Scriptrunner mail handler script


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.jira.service.util.handler.MessageUserProcessor
import com.atlassian.mail.MailUtils
import com.atlassian.jira.user.ApplicationUser
//This requires the name of the user that will trigger the Mail Handler
final def username = 'testuser'

//This requires the Project's Key that will be used for the Mail Handler
final def projectKey = 'EA'

//This requires the name of the Issue Type that will be used
final def issueTypeName = 'Story'

def userManager = ComponentAccessor.userManager
def projectManager = ComponentAccessor.projectManager
def issueManager = ComponentAccessor.issueManager
def issueFactory = ComponentAccessor.issueFactory
def messageUserProcessor = ComponentAccessor.getComponent(MessageUserProcessor)
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager

def user = userManager.getUserByName(username)
//def issueReporter = messageUserProcessor.getAuthorFromSender(message) ?: user
ApplicationUser reporter = messageUserProcessor.getAuthorFromSender(message) ?: user
def project = projectManager.getProjectObjByKey(projectKey)
def subject = message.subject as String
def messageBody = MailUtils.getBody(message)

def cfVertical = customFieldManager.getCustomFieldObjectsByName('Vertical').first()

def issue = ServiceUtils.findIssueObjectInString(subject) as MutableIssue

if (issue) {

def issueObject = issueFactory.issue
issueObject.setIssueTypeId(project.issueTypes.find { == issueTypeName }.id)

def regex = /(?<=\[\[)([^\[\]]*)(?=\]\])/
def emailMatch = (MailUtils.getBody(message) =~ regex).findAll().first() as List
def VerticalEmail = emailMatch.first() as String

issue = messageHandlerContext.createIssue(user, issueObject) as MutableIssue


def fieldConfig = cfVertical.getRelevantConfig(issue)
def options = optionsManager.getOptions(fieldConfig)
def option = options.findAll { it.value in [VerticalEmail] }

issue.setCustomFieldValue(cfVertical, option)

issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH,false)

AUG Leaders

Atlassian Community Events