0

I'm having issues creating a View in Web Browser page via a send logging Data Extension. As I need to use Display Send-Time Content Contextually.

Currently, I have:

%%[
var @SendLogData, @SubLookup, @JobLookup
Set @SubLookup = SubscriberID 
Set @JobLookup = JobID 


Set @SendLogData = lookuprows("ENT.WHG_Send_Log","View_Email_URL","SubID",@SubLookup,"JobID",@JobLookup)
]%%

%%[ if _MessageContext == "VAWP" then 

if rowcount(@sendlogdata)>0 then]%%

send logging value: %%=v(@SendLogData)=%%

%%[ ELSE ]%%

email value: %%View_Email_URL%%

%%[ ENDIF ]%%

The send logs name is WHG_Send_Log and the column that houses the VAWP link is View_Email_URL.

I am unsure if it's my AMPScript that's the issue or if that's fine if I'm using an incorrect VAWP link in the email itself.

Thanks!

3
  • What kind of issues do you have exactly?
    – zuzannamj
    Commented Jan 7, 2020 at 14:50
  • When I send the email to myself and click on the VAWP link I'm getting states, "The system is temporarily unavailable. We apologize for any inconvenience. Please try again later." My current link code is <a href="view_email_URL" > Click Here</a>
    – TZWyn
    Commented Jan 7, 2020 at 14:53
  • 1
    I have a feeling where this might lead to. Are there any dynamic content blocks or ampscript functions that need data of the sending dataextension? If yes and you do not provide that information and have no proper error handling or overwrite sending dataexetensions your vawp gets completely destroyed :) Commented Jan 7, 2020 at 14:58

1 Answer 1

2

To store Send time context, you will need to store the values at send time inside an external DE that you use to lookup your values from in VAWP context.

What you are currently doing is not working because the VAWP link will always rerun the AMPscript at time that the page is loaded, based on the data in the source DE. This also means that if the source DE is cleared or that record is removed from that DE - then the VAWP will break.

By having an upsert in the email to place all your variables into a DE, you can then utilize those for VAWP via _MessageContext similar to what you have here.

upsertDE("VAWP_Log", 2, "JobID",JobID,"SubscriberID",SubscriberID,"VarNames",@VarNames,"VarValues",@VarValues)

To make this as open ended as possible as each email could require different variables names and data types, I create 2 DE fields: 'VarNames' and 'VarValues' and then push these in as column delimited fields.

e.g.

SET @VarNames  = 'FirstName|LastName|Title'
SET @VarValues = 'Don|Juan|Mr.'

you can then push this into your VAWP DE using an upsert.

the VarNames would have to be completely manual, but as the values are usually unique per individual, you would need to do:

SET @VarNames = "FirstName|LastName|Title"
SET @VarValues = Concat( @FirstName, '|', @LastName, '|', @Title)

Then inside your email you would utilize:

%%[
var @SendLogData, @SubLookup, @JobLookup
Set @SubLookup = SubscriberID 
Set @JobLookup = JobID 


Set @VAWPData = lookuporderedrows("VAWP_Log",1,"JobID ASC","SubID",@SubLookup,"JobID",@JobLookup)

if _MessageContext == "VAWP" then 

  if rowcount(@VAWPdata)>0 then

    set @Row = Row(@VAWPData,1)
    set @VarNames = BuildRowsetFromString(Field(@Row,"VarNames"),'|')
    set @VarValues = BuildRowsetFromString(Field(@Row,"VarValues"),'|')

    FOR @i = 1 TO RowCount(@VarNames) DO

      SET @VarNameRow = Row(@VarNames,@i)
      SET @VarValuesRow = Row(@VarValues,@i)

      SET @tempName = Field(@VarNameRow,1)
      SET @tempValue = Field(@VarValuesRow,1)

      SET @FieldSet = TreatAsContent(CONCAT('%','%[SET @',@tempName, ' = ',@tempValue,']%', '%'))

    NEXT @i   

  ENDIF
ELSE 

  /* Your Normal Var setting process */

ENDIF ]%%

This would then dynamically set your Variables via the two delimited fields via the BuildRowsetFromString ampscript function.

example output:

 SET @FirstName = "Don"
 SET @LastName = "Juan"
 SET @Title = "Mr."

As a note, I would push the upsert to the end of your ELSE statement (which is the email part and I would make sure it only goes out in SEND context and not on TestSends to make your log as clean as possible.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .