WF email with empty variable

Hi,

I have WF for sending email with some fields/variables and some of them are empty. How to set WF display just nothing like " " insted of “undefined”?

Thank you.

Hello,
js supports || operator.

 ${doo.model["code"].value || ''} 

Just be careful, that 0 is evaluated as false.
And - please, do not copy my example by ctrl+c ctrl+v from this page. It adds some hidden characters into the text, so then it is not a valid expression.
Regards
Michal

That doesn’t work for me. Just returns: Custom user Javascript error (check the console for more details): Missing } in template expression.

I am sure no } missing. Why is that happening? Thx

I tested that formula again. I copied my example to a notepad++ and then back to clipboard (to clean the text) So I used the exact same expression from this page. I received the email without any errors.
Please, check the rest of the email template. Try to clean it and use only the formula I provided to you.
The example works for me.
Regards
Michal

Thanks micu,

You’re right. It works. However I did copy that code to notepad and then copy from it to WF, but it returns that same error. I need to cut (ctrl + x) all WF textarea included simple text around the code to notepad and then copy it back.

Just in case somebody looking for solution. :slight_smile: