Email Masking in Sandbox
Technical Requirement:
Post of Salesforce Developer or Tester getting requirement on Email masking. Email masking is nothing but append the text to email in Sandbox.
Description:
Every Salesforce project’s has the Sandbox environment which is the copy of Production. Which contains all the records of objects like Account and there record like number of records created in Production. These numbers of records are very high means thousands and lacks records. So at the time of Sandbox activation it will copy all records of data from production to Sandbox.
Sandbox is the test environment where Salesforce developer could do something. However before working in Sandbox we need to do mask the email fields of different object. Email field contains the original email id of users and when Salesforce developer work on this sandbox user will get email.
So we need to append the text into email field of Account, Contact, Lead, Opportunity etc objects. Like email@company.com so after email masking it will email@company.com.testfix. Issue is number of records are too large and we can not do easily. For that we need Data Loader and Salesforce Explorer tools.
Solution:
Following are steps to solve the email masking task:
- We have to fetch the records from sandbox where emails id contains ‘.com’ text according to Object. We have created SOQL and use this SOQL in data loader.
SOQL:
Select Id, Email FROM Lead where Email!=null and ( email like '%a' or email like '%b' or email like '%c' or email like '%d' or email like '%e' or email like '%f' or email like '%h' or email like '%i' or email like '%j' or email like '%k' or email like '%l' or email like '%m' or email like '%n' or email like '%o' or email like '%p' or email like '%q' or email like '%r' or email like '%s' oremail like '%t' or email like '%u' or email like '%v' or email like '%w' or email like '%g' or email like '%y' or email like '%z' )
Description of above SOQL:
We are fetching records Id and Email from Lead object those email not end with ‘x’. Like email@company.com.testfix contains ‘x’ so it will return which is not masked with ‘.testfix’ and this above SOQL run in to Data Loader.
After getting records in csv format open the file.
- Open the downloaded CSV file if file size is more than lack than use FILE SPLITTER tool in to CVS file.
Open CSV file and add below formula on second of email column. Like Column A is Email column then after B column use C column.
Formula: =IF(B2 <> C2,CONCATENATE(B2,".testfix")," ")
Copy this cell to last cell means copy this value of cell and past to end to column.
After doing above step copy the column of masked and Past Specials than select values.
Delete the Email column make sure new column should be masked.
- After above steps update this CSV file to Data Loader with selection on LEAD object.
- Open Salesforce Explorer and again fire above SOQL.
Conclusion:
We could do email masking using above steps.
No comments:
Post a Comment