%%[ Var @EventName, @EventStartDate, @EventID, @FirstName, @SubscriberKey, @EventEndDate SET @SubscriberKey = AttributeValue("_subscriberkey") SET @EventID = Lookup("ContactToOnlineEvent","Event ID","uuid",@SubscriberKey) SET @EventName = Lookup("OnlineEvent","Event Name","Event ID",@EventID) SET @EventStartDate = Lookup("OnlineEvent","Event start date","Event ID",@EventID) SET @EventEndDate = Lookup("OnlineEvent","Event end date","Event ID",@EventID) SET @FirstName = Lookup("ContactToOnlineEvent","First Name","uuid",@SubscriberKey) SET @EventStartDate = FormatDate(@EventStartDate,"dd/MM/YYYY","HH:mm tt","pt-BR") SET @EventEndDate = FormatDate(@EventEndDate,'','HH:mm') ]%%
Above is the AMPscript I have in my email. The issue I am facing right now is the wrong EventName is being pulled into the email if a record has registered for multiple events. It seems to be pulling the EventName from the first records listed in the data extension, and not the one that matches the Event ID in the data extension it is sending to.
The sending data extension is called STG_Registered_Customers, which contains 3 fields. Event ID, uuid (subscriber key), and Email Address
The ContactToOnlineEvent data extension has the following fields, Event ID, uuid (subscriber key), Email Address, and other fields like first, last name, attended status and such.
The OnlineEvent data extension contains the following fields, Event ID, Event Name, EventStartDate, EventEndDate.
Is there a way for me to get the correct event name that matches with the Event ID in the STG_Registered_Customers data extension I am sending to?