Hi all,
Does anyone can help me. I'm quite new in scripting...
I need to get a value from a calculated field (number field) and multiply it by 250
I'm using this for a field with the value "5":
import com.atlassian.jira.component.ComponentAccessor;
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10102");
def value = (String)issue.getCustomFieldValue(customField);
return value * 250
But the result is:
5.05
tks for any help
I have used Super CSV to read data but in confluence.
Should work in Jira too
https://super-csv.github.io/super-csv/examples_reading.html
Also it is good idea to run dos2unix if you have it in Linux to fix format and encoding.
// Misc manipulations
import java.nio.charset.StandardCharsets
// CSV Imports - http://super-csv.github.io/super-csv/index.html
import org.supercsv.io.CsvBeanReader
import org.supercsv.io.CsvMapReader
import org.supercsv.prefs.CsvPreference
import org.supercsv.cellprocessor.CellProcessorAdaptor
import org.supercsv.cellprocessor.ift.CellProcessor
import org.supercsv.cellprocessor.Optional
def csvFile="/some/path/csvFile.csv"
// as in https://super-csv.github.io/super-csv/apidocs/org/supercsv/prefs/CsvPreference.htmlCsvPreference PIPE_DELIMITED = new CsvPreference.Builder('"', '|', "\n").build()
def mapReader = new CsvMapReader(new InputStreamReader(new FileInputStream(localFilePath), StandardCharsets.UTF_8),PIPE_DELIMITED)
def header = mapReader.getHeader(true)
while ( (issuesMap = mapReader.read(header)) != null ) {
def issueKey = issuesMap."issue_key" def cfValue = issuesMap."custom_filed_value"
// Rest is to find issue by Key in Jira and use mutable Issue and CF Manager to set CF value
}
Same problem here...anyone to help us?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yahtzee... This seems to be the direction.
https://community.atlassian.com/t5/Adaptavist-questions/Where-do-I-drop-the-CSV-file-so-my-ScriptRunner-script-can-see/qaq-p/708356
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.