0

Hello I'm fairly new with Marketing Cloud but trying my best to be on top of it.

I'm doing a campaign wherein I include the number of days left for someone to redeem their freebies. I set the expiration date to Jan 31 2020.

I had it added on the pre header of my email and was successful doing it. Now I have several expiration date and I don't know how to update the script.

Here's the script for my pre header with fixed expiration date:

%%[
var @preheader 
set @expires = "01/31/20" 
set @date = Now() 
set @preheader = DateDiff(@date, @expires, "D") 
]%%

%%=v(@preheader)=%% days left

It will show as:

enter image description here

is there a way to get the @expires based on the info in my data extension?

I have 7 columns in my DE with the 7th as "Expires" as text

1 Answer 1

3

If I understand correctly, you are basically looking to fill the @expires variable from a DE, instead of hard coded in the script.

So, if this info is inside the sendable DE, you can do:
SET @expires = AttributeValue('Expires') //Where 'Expires is the column name of your DE

If its stored elsewhere, you will need to have a 'foreign key' (basically a matching value) to connect your sendable DE to your lookup DE. For example, let's say that EmailAddress is on both DEs. You would do the following to find the Expires data:
SET @expires = Lookup('myLookupDE', 'Expires",'EmailAddress',emailaddr) //Where 'myLookupDE' is the name of your lookup Data Extension

I would also recommend utilizing Now(1) or GetSendTime so that the VAWP, etc. (AMPscript is rerun each time it is open) match the values on your email.

1
  • Thanks for this @gortonington it did worked for the attributevalue Nov 11, 2019 at 15:47

You must log in to answer this question.

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