1

I'm trying to setup a dynamic sender profile by only changing the Sender Name based on my records sales rep. I have 2 basic data extensions I need to use, one being my sales rep table as a reference, and the table I am sending to.

My sending table:

SubKey Salutation Name Email
12345 Dr. John Doe [email protected]
12346 Dr. Jane Doe [email protected]

My sales rep reference table:

Name Email Phone SubKey
Sailor Jerry [email protected] 123-456-7899 12345
Pirate Pete [email protected] 321-654-9987 12346

The SubKey is the similar column between the two tables. I am trying to perform a Lookup and pull the Name from my Sales Rep table and paste the name in the sender profile.

This is the AMPscript i'm gaving trouble with:

%%[ 
var @SubKey, @SubscriberKey, @SalesRep
set @SubscriberKey = [SubscriberKey] 
set @SubKey = Lookup(“SendingTable”,”SubKey”,”SubKey”,@SubscriberKey) 
set @SalesRep = Lookup(“SalesTable”,”SubKey”,”SubKey”,@SubscriberKey) 
set @SalesRep = ProperCase(@SalesRep) 
IF Empty(@SalesRep) THEN SET @SalesRep = “Captain Kangaroo” ENDIF 
]%%

%%v=(@SalesRep)=%%

I plan on having the above AMPscript as a snippet, and in the sender profile to pull it by using the ContentBlockbyKey to print out the results in the sending name.

How can I make this AMPscript work to pull my SalesRep name that's associated with the record I'm sending to?

1 Answer 1

0

I would suggest to go though this article first, to understand different ways of setting up of Dynamic Sender profile.

Dynamic Sender profile ways to personalize the "from" and "reply to" address.

Also note you can use _SubscriberKey to pull the subscriberkey, without using Lookup from Sendable DE.

Dynamic From-Name

/* Use this snippet ID as ContentAreaID for FROM NAME in your Sender profile */
%%[ 
    var @SubscriberKey, @SalesRep_Name
    set @SubscriberKey = AttributeValue("_subscriberkey")
    /* set @SubKey = Lookup("SendingTable","SubKey","SubKey",@SubscriberKey)  */
    set @SalesRep_Name = Lookup("SalesTable","Name","SubKey",@SubscriberKey) 
    set @SalesRep_Name = ProperCase(@SalesRep_Name) 
    IF Empty(@SalesRep_Name) THEN 
        SET @SalesRep_Name = "Captain Kangaroo"
    ENDIF 
]%%
%%v=(@SalesRep_Name)=%%

Dynamic From-EMAIL

/* Use this snippet ID as ContentAreaID for FROM EMAIL in your Sender profile */
%%[ 
    var @SubscriberKey, @SalesRep_Email
    set @SubscriberKey = AttributeValue("_subscriberkey") 
    /* set @SubKey = Lookup("SendingTable","SubKey","SubKey",@SubscriberKey)  */
    set @SalesRep_Email = Lookup("SalesTable","Email","SubKey",@SubscriberKey) 
    set @SalesRep_Email = ProperCase(@SalesRep_Email) 
    IF Empty(@SalesRep_Email) THEN 
        SET @SalesRep_Email = "[email protected]"
    ENDIF 
]%%
%%v=(@SalesRep_Email)=%%
2
  • This appears to be working, however, it seems to only be evaluating the 1st value in the tables. Only my first record actually displays the correct SalesRep_Name, everyone else defaults to Captain Kangaroo even though the data matches and should display a SalesRep_Name Nov 4, 2021 at 14:37
  • 1
    Ended up being a misplaced comma and it is all working now. Thank you for the help and the great resource! Nov 4, 2021 at 17:59

You must log in to answer this question.

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