[SalesForce] View as Webpage custom setup for retrieval not working as expected

We recently added view as webpage URLs to our send logging data extension in order to show that url in another email.

Article for reference: https://code.exacttarget.com/question/rebuild-view-web-page-url (suggested solution implemented)
This is set in the template our email is using

Set @VAWP = TreatAsContent(view_email_url)

After exporting the send log I do see the data being populated.

I also can click on the link in the email that is pulling the send log value, it's just throwing a system error.

Here are some code snippets from the email pulling the link from the send log:

AMPscript:

Set @VAWP = LookupOrderedRows("WarmCallReport_VAWP",1,"JobID Desc","consultantNumber", consultantNumber)

     if ROWCOUNT(@VAWP) > 0 then
       SET @vawplink = FIELD(ROW(@VAWP, 1), "VAWP")
     endif

HTML:

<a href="%%=RedirectTo(@vawplink)=%%">Click here</a>

When the url is clicked in the email we get directed to this page: http://view.mail.thepamperedchef.com/?j=fec91372776c067c&m=fe9015707361037571&ls=fe2413737c67027e771076&l=fed415727565047a&s=fe5a167772620578751d&jb=ffce15&ju=&utm_medium=Email&utm_source=ExactTarget&utm_campaign=

With text: "The system is temporarily unavailable. We apologize for any inconvenience. Please try again later.”

This solution worked just a week ago, not sure what would be causing this issue now.

I did notice that the ju parameter value is missing from the stored value in the send log, when I send the original email (the one that is storing the view email link to the send log) to a recipient and click the view email link that ju parameter is populated.

Best Answer

This error is caused when the online view cannot access the data in the Sendable Data Extension you originally sent to. Usually because the Data Extension has been cleared, overwritten or deleted. When you click the view_email_url, the hosted page will try to render the email on the fly based on the data extension it was sent to. If the data is gone, this error is shown.

The solution is to use the _SendContext variable to pull the fields from the Sendlog instead of the Sendable DE.

In the following code example. I use _SendContext to lookup the values out of the Sendlog based on the combination of JobID, SubscriberID and BatchID. The combination of these 3 fields acts as the primary key in any ET Sendlog and will never be duplicated (unless you insert some data yourself). Technically they are not marked as the primary keys, but you can be confident the combination will be unique and you will always pull back the correct record.

%%[

/* If the message is being viewed as a webpage, on social forward, or as forward to a friend */
if _MessageContext == "VAWP" or _MessageContext == "Social" or _MessageContext == "FTAF" then

    /* Set the firstname from the Sendlog */
    set @FirstName = LookUp("Sendlog","FirstName","SubID",SubscriberID,"JobID",JobID,"BatchID",_JobSubscriberBatchID)

else

    /* Set the firstname variable from the DE */
    set @FirstName = FirstName

endif

]%%

Here is the article on ET help docs about SendContext, but it does not show to use BatchID which I feel is incomplete.
http://help.exacttarget.com/en-US/documentation/exacttarget/content/ampscript/how_to_use_ampscript_to_contextually_display_send_time_content/

Related Topic