Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to read from a CSV file using Groovy script .

Abyakta Lenka
September 4, 2018

Hello ,

 

I am trying to read a CSV file which has two columns 

issue_key | custom_filed_value 

i am trying to get the value of key and value using groovy script so that i can update the issue key got from the CSV .

Any help is highly appreciated .

Abyakta

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 31, 2021

This is absolutely possible, but you have to put it early in the post functions (before "Creates the issue originally").

Try it this way instead:

package com.onresolve.jira.groovy.test.scriptfields.scripts
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.user.ApplicationUser

def log = Logger.getLogger("com.acme.curvc")

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def componentManager = ComponentAccessor.projectComponentManager

def userCf = customFieldManager.getCustomFieldObject(12823L) // Developer
def components = issue.components


if(components){
issue.setCustomFieldValue(userCf, components.first().componentLead)
if(components.size() == 1){
log.info "Single component selected: applied ${components.first().componentLead.name} to Developer field"
} else {
log.info "Multiple component selected: applied ${components.first().componentLead.name} to Developer field (lead for first component)"
}
}
log.info "No component selected"
}
sm.park
January 2, 2022

@PD Sheehan Thank you for your reply Peter.

finally I resolved it.

TAGS
AUG Leaders

Atlassian Community Events