I have built an email template that my client will use in SalesForce Marketing Cloud. He requested to insert several pre-headers and subject lines in one template. Is that possible? Usually, in other systems, the same template would be used and for purpose of A/B testing the preheaders and subject lines would be set in the CRM backend...

  • Please can you provide additional information regarding your use case? What do you mean by "insert several pre-headers and subject lines in one template" and "the preheaders and subject lines would be set in the CRM backend"? Do you want to retrieve the subject line and preheader from a data source? Aug 14, 2018 at 18:15

1 Answer 1


This is what I'd have done;

You can use AMPscript to define the different Subject Line - Preheader pairs. For convenience, I've written below example with static Subject Lines - Preheaders, if you are using Data Extensions that store the text, you can change those with lookups:

SET @sl1 = 'first subject line'
SET @sl2 = 'second subject line'
SET @ph1 = 'first preheader'
SET @ph2 = 'second preheader'

Based on which criteria you'd like to use to populate the correct SL & PH, you can choose your method. Now, let's assume in this example that you're using a sendable Data Extension, and the criteria for the SL & PH is in there. You can do:

SET @characteristic = AttributeValue('FIELD_HERE')

If we assume that the values the field 'FIELD_HERE' can take are 'first_set' and 'second_set'; you can assign the correct pair to the variables which you'll use;

IF @characteristic == 'first_set' THEN
  SET @subjectline = @sl1
  SET @preheader = @ph1
  SET @subjectline = @sl2
  SET @preheader = ph2

Then you can retrieve the correct pair by just calling them in the Subject Line & Preheader fields;

  • Thanks for the answer. The thing that's troubling me is that the client claimed that it can be done without AMPScript and have sent a screenshot where those lines are visible in the template... I will do it with APMScript and try to explain. Thank you again! Aug 14, 2018 at 12:55
  • This solution won't work. You need to understand the Order of Operations used by OMM. As the preheader is evaluated before the HTML body, you can't set a variable in your HTML body then use it in the preheader. Aug 14, 2018 at 18:13
  • We've been using a similar method in my company since we migrated to Marketing Cloud, and we never encountered an issue with this. To be 100% sure, I did a test just now, and it seems to be working.
    – firko
    Aug 15, 2018 at 8:17

You must log in to answer this question.

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