3

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 
]%%
  • And what happens if you put AttributeValue() around SomeField? – Adam Spriggs May 7 '15 at 0:49
  • I'm going through a similar issue, although mine goes to an endless loop at send email activity, your solution seems to be valid but require the attribute data to be identified, have you figured that out yet? appreciate any help on this – Patrick miguel Mar 31 '17 at 14:34
3

I've found that wrapping the personalization strings in an AttributeValue() function turns the value into and empty string if the value is null, which is much more fault tolerant in the functions like lookup():

%%[
    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 = AttributeValue(SomeField)
    endif 
]%%
  • Ok, found the solution with some help from your answer. Basically, the data was never getting inserted into the DE because ET has problems with Date fields with null values. If SomeField is a null date, it has to be wrapped in AttributeValue like set @SomeField = AttributeValue(SomeField). I am going to update your answer with the final working code snippet – Jon Sakas May 14 '15 at 17:31

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.