I want to create a dynamic subject line that has a fallback if no firstname
is present.
Here is the approach I would normally take - %%[IF NOT EMPTY(First_Name) AND First_Name != "SIR/MADAM" AND First_Name != "Customer" THEN]%%%%=ProperCase(First_Name)=%%, lowercase subject%%[ELSE]%%Uppercase subject%%[ENDIF]%%
However in this instance, I want to create a variable in my code, and simply pull in this variable via SFMC.
The below approach throws me the error 'IF Not Closed An IF statement is not closed with the required ENDIF statement'
Code
set @subject = ""
IF Offer_Flag == "1" THEN
set @subject = "Non-dynamic Subject"
ELSEIF Offer_Flag == "2" AND NOT EMPTY(First_Name) AND First_Name != "SIR/MADAM" AND First_Name != "Customer" THEN
set @subject = Concat(ProperCase(First_Name), ", here’s *15% off*!"
ELSE
set @subject = "Here’s *15% off*!"
ENDIF
SFMC
%%=V(@subjectLine)=%%