Conditional First Name tag use with if/else

Hello!

Now, my %FIRSTNAME% is defaulting to “Hey” if the first name value is blank.
Any kind of default value creates limitations when it comes to creating personalized subject lines and message starts.
What I’m trying to do is super simple:

  1. Create IF/ELSE conditional personalization in the subject line that will check if the First Name field is blank and then put in a blank value (not the default for the tag)
  2. Create two conditional text blocks in the message, one of which is only used when the First Name value is blank and another when it is not.

So far, I’ve only managed to break the entire email by trying {blank} (Test sends “Your content could not be processed”, and the Spam filter processes forever).

The only topic that I have managed to find on this is:

Am I missing something obvious? Is there a way to do this at all?

I haven’t tested, but this is what I found on forum:

%IF $FIRSTNAME != ‘’%
Hi %FIRSTNAME%,
%ELSE%
Hi,
%/IF%

Hi @bungalowsoftware,

Let me know if my previous response to your other questions clears everything up. If not, we will work on getting a better solution for you.

Perry

1 Like

I tested this and it doesn’t produce the desired result. It just returns “Hi Hey” :frowning: (“Hey” is my default)

Any other ideas?

Hi @webfriendly,

I have seen “Hi There, Hi Friend, Hey There, Hey You” and others used as default values. Hope that helps!

Perry

Can you show your exact %expression% ?

Just exactly what you posted:

%IF $FIRSTNAME != ‘’%Hi %FIRSTNAME%,%ELSE%Hi,%/IF%

There is a simpler solution here: https://ideas.activecampaign.com/ideas/AC-I-10971

The expression string above does not work. Can someone please check the syntax and send a corrected/working version or provide us with the AC syntax dictionary/resource so I can generate a working expression for my emails?

We just tried this in one of our message variables and it worked for us:

%IF empty($FIRSTNAME)%
Hey,

%ELSE%

Hey %FIRSTNAME%,

%/IF%

2 Likes

Thanks for this! It worked. :slight_smile:

Did you try to add user name in your content? I have tried this on my email. You can see.

What’s wrong in the original string are the quotation marks.

Here’s the updated version:

%IF $FIRSTNAME !=’’%
Hi %FIRSTNAME%,
%ELSE%
Hi,
%/IF%

–those are two separate single quotation marks after the = , one for the opening and one for the closing.