Missed Team ’24? Catch up on announcements here.

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

How to use script runner to parse a wiki style table in a multi-text field

Mourad Marzouk May 4, 2022


I'm trying to set up a script in script runner that would trigger when a ticket transitioned to completed, this script would then take rows in the  wiki-style table in a multi-text field and create a ticket in another project for each of said rows.


would probably be something close to https://community.atlassian.com/t5/Adaptavist-questions/ScriptRunner-Read-Description-Field/qaq-p/1930159


This is what the table would look like.Screen Shot 2022-05-04 at 10.46.54 PM.png

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Darryl Lee
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 4, 2022

Hi - this can actually be done with Automation.

Turns out my answer had broken images, so I've just written a new one here:

If somebody wants to actually do this with Groovy and Scriptrunner, you should feel free to submit an answer.

Vimalraj Periyasamy December 6, 2022

I would like to run this with Groovy and scriptrunner. Can you provide me the code snippet for the same?

Bastian Wedler December 13, 2022

Hi @Vimalraj Periyasamy 

using groovy/scriptrunner is not that complicated. Maybe the following examples of writing users from a multi user field into a table, helps you:

package de.metamorphant.jira.scripts.Examples

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.user.ApplicationUser

CustomFieldManager customFieldManager = ComponentAccessor.getComponent(CustomFieldManager)
IssueManager issueManager = ComponentAccessor.getComponent(IssueManager)
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getComponent(JiraAuthenticationContext)

ApplicationUser currentUser = jiraAuthenticationContext.getLoggedInUser()

CustomField usersField = customFieldManager.getCustomFieldObject("customfield_12345")
List<ApplicationUser> userList = issue.getCustomFieldValue(usersField) as List<ApplicationUser>

StringBuilder stringBuilder = new StringBuilder()

//Adding the Header
stringBuilder.append("||Username||User displayname||Email||Active||")

//iterating through the user list and adding the rows to the table
userList.each {

//set table in multiline textField of mutable issue
CustomField textField = customFieldManager.getCustomFieldObject("customfield_23456")
MutableIssue mutableIssue = issue as MutableIssue
mutableIssue.setCustomFieldValue(textField, stringBuilder.toString())

//Write to database
issueManager.updateIssue(currentUser, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false)


Kim Tso December 28, 2022

@Bastian Wedler  Could I know whether any interface that help to convert renderedBody content into customfield value?


There are so many kinds of wiki style editor provided.

AUG Leaders

Atlassian Community Events