We use the Data Extension model in ET for our sending, which means the view_email_url breaks once the data extension is refreshed. The solution is to lookup the data from the sendlog when
_SendContext == "VAWP", outlined here: https://help.exacttarget.com/no/documentation/exacttarget/content/ampscript/how_to_use_ampscript_to_contextually_display_send_time_content/
My problem is that the Lookup() function seems to be breaking when a blank value is returned. All of the sendlog fields we use are nullable, and many will be null for any job.
I can't figure out what the error is because when I click the view_email_url, all I get is this message:
The system is temporarily unavailable. We apologize for any inconvenience. Please try again later.
If I set the same Lookup functions in the email, as in
_SendContext != "VAWP", I get this error:
Unable to generate preview A scripting error has occurred. The Lookup function call failed because the lookup field value (parameter 2) does not have a value Data Extension: Sendlog Function Call: Lookup("Sendlog",SomeField,"SubID",@SubscriberID,"JobID",@JobID,"BatchID",@BatchID) Message Context: HTML
The field that it errors on appears to be the first field it encounters with a null value.
The fields I am looking up exist in the Data Extension I am referencing, which is named "Sendlog". Both the email and Sendlog DE exist in the same child BU in an E2.0 account so there should be no need to prefix with ENT.
My code looks like this:
%%[ set @JobID = AttributeValue("JobID") set @SubscriberID = AttributeValue("SubscriberID") set @BatchID = AttributeValue("_JobSubscriberBatchID") if _MessageContext == "VAWP" then set @SomeField = Lookup("Sendlog",SomeField,"SubID",@SubscriberID,"JobID",@JobID,"BatchID",@BatchID) else set @SomeField = SomeField endif ]%%