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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to Export a Bundled Field as a CSV file?

We are using a bundled field on a request form and would like to export the field contents as a csv so each sub-field is a seperate line or column in the file.

We would also like to attach the csv to the JSD ticket.

Any help is appreciated.

We are using Extention for Jira Service Desk and we have Scriptrunner also.

2 answers

1 accepted

0 votes
Answer accepted

I ended up writing a Scriptrunner script to make this work.  The script runs as part of an automation that works with the issue.  It isn't great code, but it works for me. 


Here are some other threads I reference to build my code.

get Data:
write to file:
attach file:


import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper
import org.apache.log4j.Logger
import org.apache.log4j.Level
import org.apache.http.entity.ContentType
import groovy.json.StreamingJsonBuilder
import org.apache.http.entity.ContentType
import com.atlassian.jira.issue.comments.CommentManager
import groovy.json.JsonOutput
import com.atlassian.jira.issue.*
import com.atlassian.jira.issue.attachment.*
import webwork.action.ActionContext

//create File to store datain
File file = new File("/home/jira/RPA New Process Details.csv")

//key of issue, where the bundledfields value is
String issueKey = issue.key
//id of bundledfield where we are looking for value
String bundledFieldId= "customfield_14200" //rpa new process details field
//row in bundledfield
Integer row = 0

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfBundledFields = customFieldManager.getCustomFieldObject(bundledFieldId)
def thisIssue = issueManager.getIssueObject(issueKey)
def attachmentManager = ComponentAccessor.getAttachmentManager()
def user = ComponentAccessor.getJiraAuthenticationContext()?.getLoggedInUser()

String cfValue = issue.getCustomFieldValue(cfBundledFields)
Object jsonValue = new JsonSlurper().parseText(cfValue)

//first field column in bundledfield
String fieldName = "Department"
//grab each field value and store in variables
def department = getValue(fieldName, row, jsonValue)
fieldName = "Name of Process"
def processName = getValue(fieldName, row, jsonValue)
fieldName = "Description of Process to be Automated"
def processDescription = getValue(fieldName, row, jsonValue)
fieldName = "Corporate Priorities Alignment (Check all that apply)"
def priorities = getValue(fieldName, row, jsonValue)
fieldName = "Systems Impacted (List all that apply, Outlook, Access Point, Mapper, CLMS, etc.)"
def impactedSystems = getValue(fieldName, row, jsonValue)
fieldName = "Is process highly manual and repetitive?"
def manual = getValue(fieldName, row, jsonValue)
fieldName = "Is data in electronic format?"
def electronic = getValue(fieldName, row, jsonValue)
fieldName = "Is the process rules driven?"
def rules = getValue(fieldName, row, jsonValue)
fieldName = "Are there many exceptions to the process?"
def exceptions = getValue(fieldName, row, jsonValue)
fieldName = "Is there a high process volume?"
def volume = getValue(fieldName, row, jsonValue)
fieldName = "Any planned changes to this process workflow or technical systems it uses?"
def plannedChanges = getValue(fieldName, row, jsonValue)
fieldName = "If yes, when are these changes expected?"
def changesExpected = getValue(fieldName, row, jsonValue)
fieldName = "How does automating this process help team members do their jobs better?"
def helpTeam = getValue(fieldName, row, jsonValue)
fieldName = "Is there a deadline for this BOT to be in production?"
def deadline = getValue(fieldName, row, jsonValue)
fieldName = "If there is a deadline, what are the factors that are impacting this deadline?"
def impactDeadline = getValue(fieldName, row, jsonValue)
fieldName = "What is the expected life for the BOT? (Is this short term, long term, etc.)"
def expectedLife = getValue(fieldName, row, jsonValue)

// write to the csv file
file.write "Department,"+department+",Name of Process,"+processName+",Description of Process to be Automated,"+processDescription+",Corporate Priorities Alignment (Check all that apply),"+priorities+",Systems Impacted (List all that apply),"+impactedSystems+",Is process highly manual and repetitive?,"+manual+",Is data in electronic format?,"+electronic+",Is the process rules driven?,"+rules+",Are there many exceptions to the process?,"+exceptions+",Is there a high process volume?,"+volume+",Any planned changes to this process workflow or technical systems it uses?,"+plannedChanges+",If yes when are these changes expected?,"+changesExpected+",How does automating this process help team members do their jobs better?,"+helpTeam+",Is there a deadline for this BOT to be in production?,"+deadline+",If there is a deadline what are the factors that are impacting this deadline?,"+impactDeadline+",What is the expected life for the BOT?,"+expectedLife

// build attachment
def bean = new CreateAttachmentParamsBean.Builder()
.file(new File("home/jira/RPA New Process Details.csv"))
.filename("RPA New Process Details.csv")

// attach file to ticket

////Methods below are used to Retrieve a value of requested row and field name
def String getValue(fieldName, row, jsonValue) {
List fields = getFieldsForRow(row,(Map) jsonValue)
Map field = getFieldByName(fieldName,fields)
def value = getFieldValue(field)
return value

def String getFieldValue(Map field){
def type = field.type
if(type == 'select' || type == 'checkbox'){
return getOptionValue(field)
return field.value

def String getOptionValue(Map field) {
List<Map> allOptions = (List<Map>) field.options
String val = field.value
String[] selectedIds = val.split(',')
List<Map> selectedOptions = allOptions.findAll { in selectedIds }
return', ')

def Map getFieldByName(fieldName, List<Map> fields){
return fields.find{ == fieldName}

def List getFieldsForRow(row,Map json){
List fields = null
int i=0
json.each{k,v ->
if(i == row){
fields = ((Map) v).get("fields")
return fields


I am trying to find a solution as well, but don't have anything yet. The bundled field has the values stored in there, so trying to see if there is a way to use a script (or other add-on) that could automatically populate another set of fields (hidden from user) that can be used for an export. That is my approach but do not have a solution yet.

Below is the beginning of a bundled field value string, just for the first element. I bolded the field name and value that I would try to parse out, with the field name being the target hidden field, and the value the populated data. 

So trying to get the best of both - a bundled field for the UI, and a separate field for the data to export,


We'll see if this is possible.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

203 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you