0

We would like to setup a dynamic sender profile with a static element. The from name is to be based on a Data Extension we are using to send to. This is quite straight forward to setup however we would also like to include our company name as well which isn't in the data and is static for all Eg: %%sales_manager%% - Salesforce

So when they received their email it will look like this:

John Smith - Salesforce

John Smith is pulled from the data where "- Salesforce" is always appended

How would you go about doing this?

Thanks in advance Andy

1 Answer 1

1

This should be fairly simple. You would place the following code either in the SenderProfile 'From' name or inside a content block and call it in.

%%[ set @name = AttributeValue("sales_manager") if not empty(@name) then set @from = CONCAT(@name, " - Salesforce") else set @from = "Salesforce" endif ]%%%%=v(@from)=%%

This will also allow you to have a default value if the sales_manager field is empty.

Basically what it does is use the AMPScript function CONCAT() to combine the values into a single variable that you then output using v().

If you use a Content block to store this, you need to make sure to use an HTML block or Code Snippet block. Then you call it in your 'From Name' field using %%=ContentBlockbyKey("myContentBlock")=%% or similar function.

I believe technically you could also do the following, but it is not recommended as it has risk for erroring or displaying empty or incorrect information: %%sales_manager%% - Salesforce

Based on your comment about converting/changing names. See below code as an example:

%%[
   set @name = AttributeValue("sales_manager")  

   if @name == "Michael Smith" then
     set @name = "Mike Smith"
   elseif  @name == "Joseph Blow" then
     set @name = "Joe Blow"
   endif

   if not empty(@name) then
     set @from = CONCAT(@name, " - Salesforce") 
   else
     set @from = "Salesforce" 
   endif
]%%
%%=v(@from)=%%
5
  • thanks that worked perfectly
    – Andyw
    Commented Apr 3, 2019 at 19:24
  • would it be possible to add additional logic so that we can modify names Eg: my real name if Michael Smith however people know me as Mike Smith? Could you do this so that if data says Michael Smith display Mike Smith, rules for about 5 people that are like this?
    – Andyw
    Commented Apr 4, 2019 at 3:19
  • 1
    Thanks, i get this error, any idea why? Error 1: Script IF Statement Invalid<br>The script condition contains an invalid comparison operator. Condition: @name = "Joseph Blow" <br>Invalid Content: <br>if @name = "Joseph Blow" then set @name = "Joe Blow"
    – Andyw
    Commented Apr 4, 2019 at 20:46
  • my fault. I forgot to add the double = to the comparison. Updated answer Commented Apr 4, 2019 at 20:49
  • That worked a treat, thanks again for your help, much appreciated
    – Andyw
    Commented Apr 5, 2019 at 1:54

You must log in to answer this question.

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