I am trying to pull Subject Lines from a separate data extension than our sendable data extension. There are different subject lines stored here, and they vary by each record.

I'm using the LookUp() function, but for some reason it only works if I choose the data extension that I am supposed to be looking up for a send preview in Exacttarget.

So let's say my sendable data extension is called "SendableDE" (creative, right?) and the data extension that I am looking up is "DEWithSubjectLines". For example, I have

%%[SET @subjectLine =     Lookup("DEWithSubjectLines","SUBJ_LINE","SUB_KEY",_subscriberkey)]%% Returns:     %%=v(@subjectLine)=%% 

So, if I choose "SendableDE" when I do a Send Preview in ET, the function returns nothing.

But, if I choose "DEWithSubjectLines" when I do a send preview, the dynamic subject line is returned as intended and changes as I click through the different records. But why would it only work with that data extension? That pretty much defeats the purpose of the LookUp function.

I must be missing something conceptually here. Any thoughts? Thanks!

P.S. I also tried this:

%%[SET @subjectLine =     Lookup("DEWithSubjectLines","SUBJ_LINE","SUB_KEY",SUB_KEY)]%% Returns:     %%=v(@subjectLine)=%% 
  • Your code seems to imply that in data extension DEWithSubjectLines, there is a subject line for every subscriber key. Is that the case? Dec 7 '15 at 19:59
  • Yes. Every record has a subject line set in the SUBJ_LINE column. This is how the data file we receive comes over to us and I can't change the process. I would like to be able to click through the Send previews and see the subject line change for each record. This is easy if the DE you use for the send preview has the subject lines set for each record. I would just use %%SUBJ_LINE%%. The issue I'm having is pulling these SL's from a different DE than our Sendable DE. Thanks for your time!
    – jake314159
    Dec 7 '15 at 22:19
  • Did you try utilizing the AttributeValue ampscript. Do your lookup with '@lookup' variable, then have your '@subjectline' = AttributeValue('@lookup'). the ' around the variables are so that comment will allow me to add in. Dec 8 '15 at 16:35

It sounds like the SubscriberKeys in your Sendable DE and your Lookup DE don't match, ie, the current record in the Sendable DE doesn't have a matching record in the Subject Line Lookup Table. Could this be the case?

  • Hmm that most likely is the case! I thought I could just do a lookup function to grab data from any DE, but apparently in order to have specific SL's tied to each record, (by the subscriber key), all the subscriber keys need to be the same in both DE's?
    – jake314159
    Dec 8 '15 at 15:19
  • I set up a quick test with 2 DE's having the same subkeys. It worked! Thanks a bunch! I knew I was missing something conceptually. (Marked as Answered)
    – jake314159
    Dec 8 '15 at 17:40

The issue may be that you must use inline AMPScript for the email properties, (i.e. subject line, cc, etc.). Try putting the inline AMPScript directly in the subject line %%=Lookup("DEWithSubjectLines","SUBJ_LINE","SUB_KEY",_subscriberkey)=%% in place of the variable @subjectline.

  • That's not true. I've used AMPScript variables for the subject line many times. Dec 8 '15 at 16:21
  • 1
    it is more efficient to include this information in the body of the email and reference a variable as that is rendered server side prior to subject and from/to information. Also, I find inlining ampscript functions to be much more prone to error than utilizing variables and referencing. Dec 8 '15 at 16:24
  • It was my understanding that you had to use inline for any of the envelope fields, my apologies if that is incorrect. Dec 8 '15 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.