We currently have two versions of our emails with one version showing rewards content and the other not. While we'll soon be combining the two, for now we still have them separated. As such, we are attempting to display content conditionally upon membership in a list. We will send email A to List A, and if the customer is also in List B then we will show content X, otherwise we will not. This is currently being handled with Ampscript for the email that's being sent to a data extension, by first determining via Lookup() if the customer's email address is in the target DE, and then by using simple IF...ELSE within the email body.
-
Your question seems incomplete.. it seems like you have a solution that is working. Why change it?– 0xsegfaultCommented May 30, 2017 at 20:27
-
Ah my mistake - we can use the above solution for data extensions, but I don't believe that you can do a Lookup() on an SFMC list.– Stephen BoyetteCommented May 30, 2017 at 20:41
1 Answer
You can't use the Lookup functions to retrieve data from Lists. You could hack away and use AMPScript InvokeRetrieve against the ListSubscriber API Object - potentially through a Landing Page, but this wouldn't be advisable if this is for a mass send to many subscribers as you'd take a big hit on send speed and probably blow out your Super Message quota.
Preferable for large sends would be to pre-process your sendable data using a Query Activity. You might use something like this...
SELECT
c.SubscriberKey,
c.EmailAddress,
CASE
WHEN l.SubscriberKey IS NOT NULL THEN 1
ELSE 0
END AS InListB
FROM
MyCustomerDE c LEFT JOIN
_ListSubscribers l WITH (NOLOCK)
ON c.SubscriberKey = l.SubscriberKey AND
l.ListID = 12345
Without knowing too much about your data it's hard to give you the actual SQL you need, but the principle stands - pre-process before sending for scalability.
-
I think you're right - it'd be unwise and really unnecessary to do the extra work involved to handle this (admittedly edge) case. Thanks for your solution though, it will likely be useful in future! Commented Jun 1, 2017 at 11:36