Hello,
I have a custom field that I would like to update depending on what value is entered for an Extension for Jira Service Desk's bundled custom field. When I access the value of a bundled field from a groovy script in a workflow post function I use something like:
Integer row = 0
for(row = 0; row < 10; row++){
def finalTravelExpenses = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Final expense 2")
String finalExpenseValue = issue.getCustomFieldValue(finalTravelExpenses)
if(finalTravelExpenses != null){
Object jsonValue = new JsonSlurper().parseText(finalExpenseValue)
List fields = getFieldsForRow(row, (Map) jsonValue)
Map expensePaidToOther = getFieldByName("Amount Paid to Other", fields)
def expensePaidToOtherValue = getFieldValue(expensePaidToOther)
}
}
def String getOptionValue(Map field) {
List<Map> options = (List<Map>) field.options
Map option = options.find { it.id == field.value }
return option ? option.name : null
}
def Map getFieldByName(fieldName, List<Map> fields) {
return fields.find { it.name == 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")
}
i++
}
return fields
}
What I was wondering is, is if I want to get this field's value in the customer portal using groovy script and a tool like ScriptRunner's Behaviours, is it possible to obtain, or is it only available to access after the issue is created.
Thank you
Hi @Priska Aprilia ,
There should be a logger for every run of the script listener.
What is the error when you create the issue via JSD?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.