0

I had a Content area that uses LookupRows() to retrieve a set of products from a Data Extension at time of email send. Every week we rebuild/re-populate this DE with new products.

If you open an email from a previous week the text/links are fine in the email client, but if you click the "View Online" link, the email/AMPScript is re-rendered and it retrieves text/images/links from the current week (since the DE data was replaced).

Is there a way to "bake" (make static) Lookup values so that they are rendered once "on send", and never again?

If not achievable in AMPScript, is there another way of doing it?

3

You really need to use a combination of AMPScript to contextually show content based on the context of where the message is being viewed - in someones inbox, from the view as web page link etc. Depending on this context, you either read the data used in the email from the sendable DE you're using for the send or you look up a point-in-time copy of the data used for the email at the time is was originally sent.

I'm assuming you have "Send Logging" enabled in your account and you have a send log Data Extension created that contains all the fields you would need to personalise your message with send-time content.

%%[
    /* Check message context to determine if we want to retrieve send time values from Send Log or not */
    IF _messagecontext == 'VAWP' OR _messagecontext == 'FTAF' OR _messagecontext == 'SOCIAL' THEN
        /* Get data from the Send Log data extension. Key is JobID, ListID, BatchID, SubscriberID */
        SET @sendLogRows = LookupRows("MySendLogDE","JobID",JobID,"ListID",ListID,"BatchID",_JobSubscriberBatchID,"SubscriberID",subscriberid)

        IF ROWCOUNT(@sendLogRows) > 0 THEN
            SET @sendLogRow = ROW(@sendLogRows,1)
            SET @SomeField = FIELD(@sendLogRow,"SomeField")
            SET @AnotherField = FIELD(@sendLogRow,"AnotherField")
        ELSE
            REDIRECT("http://some/fieldly/error/page")
        ENDIF    
    ELSE
        /* Get data from the current list or data extension being sent to */
        /* Important that the name of variables matches fields in the Send Log DE for logging at time of send */
        SET @SomeField = SomeField
        SET @AnotherField = AnotherField
    ENDIF
]%%
SomeField: %%=v(@SomeField)=%%<br />
AnotherField: %%=v(@AnotherField)=%%<br />

Given you only have one Send Log DE per Business Unit, I tend to use a slightly more complex piece of AMPScript than that above where I build an XML Document in a variable that contains the values of all the data I need to re-render the email in a View As Web Page link - typically I call the variable holding the XML Document "@Data" and have a text field in my send log data extension called "Data" that has no maximum length to accept this BLOB content at time of send. This allows you to use the Send Log Data Extension for all manner of emails that would require similar send-time rendering for VAWP.

  • Thanks Andrew - Good solution with great use of the Send Log DE; very applicable in some situations. However I'm hoping for a "Static" solution for baking DE lookups into a content area/email, removing future AMPscript/lookup events from occurring. +1 for good answer though! – Cameron Robert Jul 10 '17 at 2:40
  • I think I see. Above is the way you'd normally do this, but if you have not so many variations of your content, you could use TreatAsContentArea to create "Virtual Content Areas" on the fly. These are cached copies of the content that was generated at the time of send and never re-evaluated. The rub is you're limited to 300 such content areas being created for each email before the caching behaviour flips to evaluating your content for new keys based on current data in your data extension. – Macca Jul 10 '17 at 2:58
0

The key is not not overwrite your sending audience.

I approach it by importing into a master data extension with a insert date column and send to a data filter of the rows inserted on today's date.

This method ensures that the content is available in the each of the message contexts.

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.