I have a Jira field that allows multi select values to be selected from a drop down. I created a new custom field in the Data Import set-up, under Custom Fields. The intent is to return the word “Multiple” when more than one value exists and just return the value when only one value exists. This is done by checking if a comma exists in the value, as values are separated by commas.
The custom field correctly returns the single value, but it is not returning ‘Multiple’ for multiple values…it still returns the multiple values that are in the field.
Here is the syntax used:
// Check if LOB field is not empty and if it includes a comma (,)
if (issue.fields.customfield_15600 && issue.fields.customfield_15600.includes(“,”))
{return “Multiple”;
} else {
// Return the actual field value if no comma
return issue.fields.customfield_15600;
}
// Return undefined if field is empty
return undefined;
Here are example field values in the new custom LOB field:
Thank you so much for the suggestion. I have tried this solution but still get the same results.
// Check if LOB field is not empty and if it includes a comma (,)
if (issue.fields.customfield_15600 && issue.fields.customfield_15600.indexOf(“,”) > -1)
{return “Multiple”;
} else {
// Return the actual field value if no comma
return issue.fields.customfield_15600;
}
// Return undefined if field is empty
return undefined;
Not getting the word “Multiple” back; still getting the field values:
Ok, I tried it with your other suggestion and it is working great now. Thank you for your help!
// Check if LOB field is not empty and if it includes a comma (,)
if (issue.fields.customfield_15600 && issue.fields.customfield_15600.length > 1)
{return “Multiple”;
} else {
// Return the actual field value if no comma
return issue.fields.customfield_15600;
}
// Return undefined if field is empty
return undefined;