If calculation field
In one of my apps I have a category field with two options-- Opt In and Opt Out. I have another field with a contact email address. I would like to have a third field, a calculation field, fill in with the email address from the contact email address field only when the "opt-in" category is selected. Thanks for any help!
-
Thank you for your answers. Unfortunately, neither of those seem to work. Rainer's answer produces: Script syntax error: Unexpected token ILLEGAL. Hamid's answer produces a "noMail" result no matter the opt in or out status.
Maybe I didn't phrase my question properly. . . I have:
Field 1 (text field titled Contact Email)
Field 2 (category field titled Email Status): Opt In, Opt Out
Field 3 (calculation field titled Mass Email Address)
I would like Field 3 to populate with the email address from Field 1 when the Opt In category is selected. Otherwise Field 3 should be blank. Any further assistance appreciated!
-
Hi Sarah,
The cause for "Script syntax error: Unexpected token ILLEGAL." is mostly a typo. I see one in my formula: different kind of quotation marks around 'opt-in". But because Hamid's code doesn't work in your calculation too, I assume that you have written the category labeling in your formula like Hamid and me did - "opt-in" (whith hypen and lower case o). You have to write this part absolut exactly like your category label:
so try:
@YourCategoryField == "Opt In" ? @FieldWithContactMail : ""or Hamid's variant:
var mail = "mailto:" + @FieldWithContactMail;
var mailIf = mail.link(mail);
@YourCategoryField == "Opt In" ? mailIf : "noMail"If that doesn't help, please copy your formula and paste it here so we can see, what maybe wrong.
Btw: Bear in mind, that every change in a category label which is used in a formula must also be made in the formula.Rainer
-
Hi Rainer,
Thanks for your help. Your new formula is working now. Except that when I change the category from "Opt In" to "Opt Out" the email address that the calculation field was previously populated with does not go away. If someone opts out of our email program I need to be able to change that status and have the calculation field no longer populated. Here's what I have:
@Email Status == "Opt In" ? @Contact Email : ""
-
Did you make a refresh of the page after you changed the category? Or closed the item and opened it again?
If there is nothing other in the calculation field then the E-mail address (if status = Opt-in) you can change the formula a bit:
@Email Status == "Opt In" ? @Contact Email : null
Rainer
Please sign in to leave a comment.
Comments
7 comments