Scripting for Email Notifications - Getting the display value of a choice list

richard_selby
Kilo Guru

I'm having trouble with getting a the display value of a choice list into my mail template. Can anyone help me with the correct syntax? You think it would be getDisplayValue() but that doesn't do it.


What I want to see in my resolved template:
Dear Customer,
We have closed your incident with the following reason:
Customer- Configuration-Polite Customer Facing Phrase-another one

What I get:
Dear customer
We have closed your incident with the following reason:
cu-conf-pcfp-anoth

Below is a mail script snipped of what I have tried for the left hand variable (close code level 1), and what it prints

template.print( current.u_close_code_l1.getLabel() + "-" // Displays the field label, Close Code L1
+ current.u_close_code_l1.getDisplayValue() + "-" // displays cu which is NOT the display value, it's the value
+ current.u_close_code_l1.getValue() + "-" // undefined
+ current.u_close_code_l1 + "-" // displays cu again
)


There's a huge choice of labels/values over four levels of close codes, with lots of repetition, so I need the database values to be distinct, hence the cu conf npp style values. So I can't just make the values and labels the same on the choice list.

So what's the magic mail script line to print the display value, not the value?

7 REPLIES 7

neetusingh
Giga Guru

current.u_close_code_l1.getChoiceValue();

I hope this helps...

Regards/Neetu


Thanks Neetu, I agree the function name sounds perfect, but unfortunately it displays exactly the same value as the others! In other words the value (cu), not the display value (Customer). Any other ideas anyone?


chandan_snc
Kilo Contributor

Hi Richard,

Try this...

template.print(current.getDisplayValue('category'));


or

template.print(current.category);


Kind regards,
Chandan


Thanks for the suggestion, but
template.print(current.getDisplayValue('category')); -- returns null
and
template.print(current.category); -- returns a blank

Oh dear.