0

How can I use a boolean value passed through the data extension to determine the subject line? The subject line won't be stored in the data extension, it should be placed in the template.

If "status" == 0 show subject line "a" else if "status" == 1 show subject line "b".

1 Answer 1

2

You can do it if you just click on the subjectline and the bolt next to it, then you can create dynamic subject lines. But depending on your use case you maybe even want to do it with ampscript.

In the subjectline paste %%=v(@subjectline)=%%

Code:

%%[
VAR @status, @subjectline
SET @status = [dataextensioncolumnname]

IF @status == 0 THEN
    SET @subjectline = 'text'
ELSEIF status == 1 
    SET @subjectline = 'text'
ELSEIF status == 2
    SET @subjectline = 'text'
ELSEIF status == 3
    SET @subjectline = 'text'
ELSE
/* default subject line*/
    SET @subjectline = 'text'
ENDIF
]%%

Make sure to paste the ampscript at the right point

5
  • Thanks, this is exactly what I was looking for.
    – Anthony_Z
    Commented Jun 30, 2019 at 14:34
  • And where is the right point? Where do we paste the AMPScript code? In the same Subject Line text box? Commented Jan 13, 2020 at 10:55
  • 1
    developer.salesforce.com/docs/… . I usually tend to insert it at the top of the html body Commented Jan 13, 2020 at 12:09
  • Oh, right! So if I define and set a variable in the body of the email, it will be recognized by the subject line? Commented Jan 13, 2020 at 13:26
  • 1
    Thats the way it should work, just test it ;) Commented Jan 13, 2020 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .