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.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
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.
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)=%%!