0

Array result from Multiple-Choice Custom Field in e-mail template

Reinis Straume (LMI:T) 5 years ago in Home Portal updated by Dennis Rosenbaum 5 years ago 6

Can anybody smarter at coding save my bacon? I have a Job-scope custom field (multiple-choice), where PMs select one or more delivery formats the vendor has to deliver their job result in. I want this to show up in availability request e-mails and job starting e-mails. I got it working with the PO templates (results show in hard brackets, but it's fine), but I cannot figure out how to get it to display properly in the e-mail templates. I know the method "calls" the right field, but the output is displayed as "[Ljava.lang.String;@5d79a22d". As I understand, it has something to do with the fact that the result is an array.

+1

Easiest would be to loop over the elements and show them however you like.

#set($multiSelectField = $c.customFields.getMultiSelectField1())

#foreach($field in $multiSelectField)
$field
#end

You could also look into the Join function of the StringUtils: https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html

$utils.getCommonsStringUtils().Join()

+1

Thank you so much, Dennis! I will try this out immediately.

Huge thanks again, Dennis. This worked beautifully (I ended up going with the StringUtils option, but both worked great). Thank you for sharing your know-how!

You're very welcome!

+1

I hope that saved your bacon. :)