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)=%%