My Creative team provided the HTML and I uploaded the code in marketing cloud and used it for creating an Email message (type HTML). This Email will be sent every 15 days. But the use case is- Every 15 days when this email will be sent, following things will be new in the HTML-
- 4 -header links(heading as links- Heading text and its corresponding href's will be change)
- Image as link(one Img src and its corresponding Href, both these things will change)
- Read more Button(HTML/CSS for button remains same- but href changes)
Without manually going in the HTML each time to change these things, is it possible to handle this change in content using Amp script.
I would like to explain what I have tried till now.
I have created a non sendable DE, with 3 columns- Content, Links, Lookupfield. "Content" column contains value of the Content part of the email like - text heading,image scr etc. "Links" column contains the corresponding Href's . Lookupfield column is having a default value set to 0 during DE creation.( this field will be used for pulling rows using lookuprow() function). Here is how my DE looks like :
Also the Ampscript I have written is :
%%[
VAR @em_content,@target_links,@rows,@rowCount,@i,@row
SET @em_content = AttributeValue("Content")
SET @target_links = AttributeValue("Links")
set @rows = LookupRows("DE_ForDynamicContent","LookupField", 0)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
Output(Concat("rowCount is: ", @rowCount))
for @i = 1 to @rowCount do
set @row = row(@rows, @i) /* get row based on counter */
set @em_content = field(@row,"Content")
set @target_links = field(@row,"Links")
]%%
%%[ next @i ]%%
%%[ else ]%%
No rows found
%%[ endif ]%%
Also one of the things that I am not sure of- where should these three amp script lines be placed in the HTML?
1. %%[ next @i ]%%
2. %%[ else ]%%
No rows found
3. %%[ endif ]%%
OR should all ampscript can reside together in one codesnippet?
Hi @VijayaKapadam , In would like to share that I modified my DE , its like this now
Also the Ampscript added in my HTML email
%%[ SET @UniqueSendID="Test_Send1" SET @ImgSource=Lookup("DE_ForDynamicContent_NewVersion", "ImgSource", "UniqueSendID", @UniqueSendID) SET @ImgHref=Lookup("DE_ForDynamicContent_NewVersion", "ImgHref", "UniqueSendID", @UniqueSendID) SET @HeaderLinkText1=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinkText1", "UniqueSendID", @UniqueSendID) SET @HeaderLinkHref1=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinkHref1", "UniqueSendID", @UniqueSendID) SET @ReadMoreHref1=Lookup("DE_ForDynamicContent_NewVersion", "ReadMoreHref1", "UniqueSendID", @UniqueSendID) SET @HeaderLinkText2=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinkText2", "UniqueSendID", @UniqueSendID) SET @HeaderLinkHref2=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinkHref2", "UniqueSendID", @UniqueSendID) SET @ReadMoreHref2=Lookup("DE_ForDynamicContent_NewVersion", "ReadMoreHref2", "UniqueSendID", @UniqueSendID) SET @HeaderLinktext3=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinktext3", "UniqueSendID", @UniqueSendID) SET @HeaderLinkHref3=Lookup("DE_ForDynamicContent_NewVersion", "HeaderLinkHref3", "UniqueSendID", @UniqueSendID) SET @ReadMoreHref3=Lookup("DE_ForDynamicContent_NewVersion", "ReadMoreHref3", "UniqueSendID", @UniqueSendID)
]%%
Also I am displaying the content as per your suggestion using redirect() to and v() function.
Can you share what code can be added for fallback scenerio?