We have a sendlog enabled for our account to capture all sends from all BUs.

In the SendLog DE, in past we added the personalization string %%emailname_%% to capture emailname as well (of course without %%). In SendLog DE, the exact field name is - emailname_

  • emailname_ field has been capturing the email name for years now.

You can view all personalization strings listed here: https://help.salesforce.com/s/articleView?id=sf.mc_es_available_personalization_strings.htm&type=5

Now, we want to capture the sendable audience data extension as well for all email sends in the SendLog and salesforce support suggested to add personalization string %%_DataSourceName%%, so I tried adding the field _DataSourceName in the SendLog DE but it looks like data extension does not allow field name to start with an underscore _.

In this case, what is the solution and how to add _DataSourceName in the SendLog? Any advise?

2 Answers 2


You have to set a variable for it in your email or template:


set @DataSourceName = AttributeValue("_DataSourceName")


But keep in mind -- you won't get accurate results, since you can target multiple DEs in a send definition.

Also, this is not a good use case for the SendLog since everyone targeted by the send would have the same value.

It may be a better option to mirror the Send SOAP object data with SSJS and pull in the actual target DE info from the send definitions.

  • Hi @Adam Spriggs yes totally understandable. In our use-case audience DE will always be same and based on some business requirements, capturing audience DE name in SendLog is the best route for now. On your comment on variable, emailname_ personalized string is not in the email code but captures the value automatically in send log, even if variable needs to be added for _DataSourceName in email, how can I add this field in the SendLog DE. That's where I am experiencing the issue when field name starts with underscore _
    – kl2
    Jun 30, 2022 at 13:41
  • Hi Adam - With this approach SendLog will automatically pickup the value from the variable @DataSourceName in DataSourceName field? if I add DataSourceName field (WITHOUT underscore) in SendLog DE.
    – kl2
    Jun 30, 2022 at 17:16
  • The point of the AMPscript block is the match the SendLog column name -- it won't record it if the names are different. Jun 30, 2022 at 19:21

Adding to the other answer.

Be careful with relying on %%_DataSourceName%%.

%%_DataSourceName%% does NOT work with Journey Builder Sendouts.

The headline over that help article you quote is "Personalization Strings in Email Studio" - This is meant verbatim.

to explain: In the past, sometimes Journey Builder was referred to as another "channel" from emails, and here is one nasty little difference that of course is absolutely counterintuitive.

  • Hi @Jonas Lamberty thank you for sharing the information (def good to know for journeys). I guess, one of my question is, how to add a field in DE that starts with an underscore? _DataSourceName
    – kl2
    Jun 30, 2022 at 16:44
  • you can't - see adam's answer. name the field after the AMPscript variable, e.g. dataSourceName instead and define that variable in the email using attributeValue() as he described. Sendlogging matches AMPScript vars it finds in the email automatically, so you don't need to match the field name to the personalization string if all your mails contain the respective AMPScript. Jun 30, 2022 at 16:59
  • Ok so just confirming, field name that can be added to SendLog is going to be DataSourceName while the ampscript as per Adam, I see will pull the value from _DataSourceName in a variable DataSourceName (WITHOUT underscore). So, SendLog will automatically pickup the value from the variable @DataSourceName in DataSourceName field?
    – kl2
    Jun 30, 2022 at 17:15
  • yes. help.salesforce.com/s/articleView?id=000333925&type=1 "At send-time, data is written to the SendLog and can be added to in a couple of different ways; [...] AMPScript variable name matches the Field Name of the SendLog Data Extension" Jul 1, 2022 at 6:27

You must log in to answer this question.

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