Hi Atlassian Community!
The scenario I have is a multiselect custom field that I want to copy to a label type customfield (Not the issue label)
The issue I'm having is I can't copy the values one to one, I need to append the keyword "skill#" before each value returned by the multiselect, and replace all spaces with "_".
one thing that kinda worked was: "skill#" + findReplaceAll(%{issue.cf19904}, " ", "_")
That works great if I'm selecting one item, however for multiple I get:
skill#This_Is_The_First_Item,_This_Is_The_Second_Item

I'm wondering if there's a "for each" in the return of a multiselect. I understand a multiselect returns a string, not a list, but if I try toStringList(%{issue.cf19904},","), I get a generic error in JWT:

I was able to achieve what I need using scriptrunner, but I'd really prefer to do it in JWT instead if possible.
For those curious, this is my script in scriptrunner:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.label.Label
import com.atlassian.jira.issue.label.LabelManager
CustomField skillsList = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_19904")
def skillsListValue = issue.getCustomFieldValue(skillsList)
CustomField skillsLabel = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_15300")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def labelManager = ComponentAccessor.getComponent(LabelManager)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def skillFieldID = customFieldManager.getCustomFieldObject("customfield_15300").getIdAsLong()
def joinedList = skillsListValue.collect { "skill#$it" }
joinedList = joinedList.collect {it.toString().replaceAll(" ", "_")}
for (skill in joinedList){
labelManager.addLabel(currentUser, issue.getId(), skillFieldID, skill, false)
}
Thank you all in advance