0

Below is the DE i am sending to. Its called Power_NovaMep

enter image description here

Below is the Target DE called SendLog

I want the value of Ref_no from the Power_NovaMep DE go to the Send_Ref column in the SendLog DE when the email is sent. Email__c can be used as a lookup to find the right row to update.

enter image description here

Below is my code. I want to know why it is not working.

%%[ var @lookupValue set @lookupValue = AttributeValue("_subscriberkey") ]%% %%[ var @Refno set @Refno = Lookup("Power_NovaMEP","ref_no","subscriber_key",@lookupValue) ]%% %%[ var @emailAddress set @emailAddress = AttributeValue("emailaddr") ]%% %%[ UpdateDE("SendLog",13,"Email__c",@emailAddress,"Send_Ref",@Refno) ]%%

1

Your SendLog data extension looks like it's been created using the Email Send Log Data Extension Template, so there's no need to do any explicit UpdateDE(). The send log captures any variables according to the following soft-mapping:

  1. Any AMPScript Personalization Strings that match the name of the a field in your SendLog Data Extension. Note that leading underscores are disregarded from comparison of names - eg: "_DataSourceName" == "DataSourceName"
  2. Any AMPScript variables that match the name of a field in your SendLog Data Extension. Note that the leading "@" in the AMP variable name is disregarded from name comparison - eg: "@Send_Ref" == "Send_Ref"

Thus, these lines would result in your Send_Ref and Email_c fields being populated at time of send:

%%[
set @Send_Ref = AttributeValue("Ref_no")
set @Email__c = emailaddr
]%%
| improve this answer | |
  • Thanks Macca. I will give this a go. Am i right in assuming that if we were sending to a non templated DE then the way i have written it would be the way to pass the value? i.e. First Lookup value and then updateDE? – Rahul G Jun 19 at 0:17
  • 1
    If you haven't created the SendLog using the Send Log Template, you should probably consider doing so. Your use case matches the purpose of send logs and is far more lightweight than manual coding of AMPScript... You get all that functionality for free. InsertDE() or UpsertDE() are your functions to use for writing to a Data Extension where you're potentially inserting new records. – Macca Jun 19 at 0:29
  • Got it. Thank you. i meant it as a hypothetical. I will send an email today and check the log tomorrow morning to see if the Ref_no is passed. Thanks again Macca. – Rahul G Jun 19 at 0:42
  • That worked like a charm. Thank you. – Rahul G Jun 21 at 20:35

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.