0

I need to remove spaces and accents (special characters) and capital letters from the 'From Email Address' field in the sender profile. Indeed, I would like to compose a dynamic From Email Address in the sender profile based on the Salesforce CRM account name (which would be a variable) and a static domain name which is verified. The account name is retrieved from Salesforce as the journey data entry is Salesforce data entry.

  1. I would like to concat the account name and the static domain name
  2. I would like to know how to remove the capital letters, the accents (eg :'à', 'â', 'é', 'ê', 'è', 'ù') and the spaces that can be in the field account name.

--> Example of desired output : If the field value on the account name is 'John Dôe' and the verified static domain name is '@digitalforu.com', the output should be '[email protected]'.

How can I proceed to do these actions ? I had put the following code in the 'From Email Address' field in sender profile but I do not know how to solve the issue of accents, spaces and capital letters that can appear in the account name.

%%[set @accountname = AttributeValue("Opportunity:Account:Name") if not empty (@accountname) then set @FromEmailAddress = CONCAT(@accountname, "@digitalforu.com") else set @FromEmailAddress ="@digitalforu.com" endif ]%% %%=v(@FromEmailAddress)=%%

2 Answers 2

1

Honestly there is no simple solution here so it is gonna be a mess and far from efficient in AMPscript. Would be better to manipulate prior to send. Below is partial example on approach:

%%[
set @accountname = replacelist(replacelist(lowercase(AttributeValue("Opportunity:Account:Name")),"a","à","á","â","ã","ä","å","æ","ā","ă","ą"),"c","ç",ć","č")...etc per symbol letter

Breakout example to build from

/* Set attribute to var */
Set @accountname = AttributeValue("Opportunity:Account:Name")

/* push to lowercase */
Set @accountname = lowercase(@accountname)

/* replacelist for each version of 'a' with symbols */
Set @accountname = replacelist(@accountname,"a","à","á","â","ã","ä","å","æ","ā","ă","ą")

/* continue this for each letter that can have symbols */

/* remove spaces */
Set @accountname = replace(@accountname," ","")
1

I would use a combination of AMP Script and SSJS to handle this. I would setup the workflow as follows:

Step 1) Get the Value

%%[
    SET @accountname = AttributeValue("Opportunity:Account:Name")
]%%

<script runat="server" language="javascript">
   set accountname = Variable.GetValue("@accountname");
</script>

Step 2) Remove the Accents

There are plenty of examples on how to do this via JS that I won't write a solution but I'll link out to a Stackoverflow article (here). The accepted answer using maps would be supported in SSJS on SFMC.

Step 3) Set the Value

<script runat="server" language="javascript">
   set accountname = result; // result from stackoverflow
   Variable.SetValue("@accountname ", accountname);
</script>

At the end of Step 3; you have a non-accented accountname on which you can do any if, else checks that you like to derived your FromAddress.

You must log in to answer this question.

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