0

I am trying to populate DE row's in email body . Ex , First Name , Last name and Email address from a DE to the email content . I would like to have it populated through a script as with standard functionality I am not able to achieve it.

Thanks

  • 1
    Welcome to SFSE. Can you please share the script you have tried using? It will be helpful if you also shared the structure of your Data Extension, and whether you are fetching data from your sendable Data Extension or need to do a lookup. – Lukas Lunow Jun 28 at 18:51
3

If you mean from the sendable, you can utilize personalization strings. This includes any fields you use when sending from a data extension.

Say your sendable DE looks like this:

SubscriberKey  |  EmailAddress  |  FirstName  |  LastName

You would use the following personalization strings:

%%SubscriberKey%%  |  %%EmailAddress%%  |  %%FirstName%%  |  %%LastName%%

But, I would recommend instead utilizing AttributeValue() to collect these. (e.g. SET @email = AttributeValue('EmailAddress') for inside AMPscript block or %%=AttributeValue('EmailAddress')=%% for inline use.

If you want to use relational data stored in a separate data extension from the sendable, this would be best achieved through a lookuprows or lookuporderedrows.

As it is generally the more utilized language in emails, I am going to show an example in AMPscript:

%%[
set @SubscriberKey = AttributeValue('SubscriberKey')
set @rowset = LookupRows('myLookupDE','SubscriberKey',@SubscriberKey)
set @row = Row(@rowset,1)
set @Email = Field(@row,"EmailAddress")
set @FirstName = Field(@row,"FirstName")
set @LastName = Field(@row,"LastName")
]%%

which is then output like this:

Hello %%=v(@FirstName)=%% %%=v(@LastName)=%%, your Email Address is %%=v(@Email)=%%!
| improve this answer | |

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