I usually just put all of the AMPscript for subject lines in the subject line itself, but there are a metric ton of versions for this one I'm working on, so it's exceeding the 400 character limit when I go to send it.

So I'm trying to set the subject lines in the body of the email, but it's not working for me. SFMC isn't breaking the email, so the AMPscript has no errors, but it's not doing what I want.

I need the subject line to vary depending on the VERSION_CODE in the DE.

My subject line contains:


And in the body of my email I have:

%%[var @vcode
Set @vcode = VERSION_CODE]%%

 var @subjectline,

 if (@vcode == "FEP_Truck_Private_Urban_EN") OR (@vcode == "FEP_Truck_Private_Rural_EN") OR (@vcode == "FEP_SUV_Private_Rural_EN") OR (@vcode == "FEP_SUV_Private_Urban_EN") then 

 set @subjectline = "OFFER 1"

 elseif (@vcode == "FEP_Truck_NoOffer_Urban_EN") OR (@vcode == "FEP_Truck_NoOffer_Rural_EN") then

 set @subjectline = "OFFER 2"

 elseif (@vcode == "FEP_SUV_NoOffer_Urban_EN") OR (@vcode == "FEP_SUV_NoOffer_Rural_EN") then

 set @subjectline = "OFFER 3"

 elseif (@vcode == "FEP_Combo_PrivateEN") then

 set @subjectline = "OFFER 4"

  elseif (@vcode == "FEP_Combo_NoOfferEN") then

  set @subjectline = "OFFER 5"




Nevermind, I found the issue.

Instead of this in the subject line:


I needed to have this


  • It seems that your logic depends on a field in the data extension you are sending to. Is there any specific reason why you don't use dynamic content for this? This would be the easiest way to achieve the same and it's more comfortable to manage for non-technical users Jul 1 '19 at 17:35
  • You could also put the subject inside the sendable or a relatable DE and call that in via Lookup or AttributeValue (sendable value). Jul 1 '19 at 19:48

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.