function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
matty80matty80 

Field Find & Replace

I'm taking on a large de-duplication project for fourth quarter, and trying to set tighter standards on our users going forward to complement this effort. One of our ideas is to automate "find & replace" of text after a new record is saved (for example, inside Company Name, it might take Credit Union and shorten it to CU). Rather than roll out a multitude of rules for them to reference or remember, we're trying to automate the execution. 

The first thought is for the system to reference a "key" of the search criteria and then the text to replace it with (perhaps a list or, even better a csv file with all of the transformations). Right now I'm thinking that a trigger may be the best way to go. Has anyone dealt with a similar problem or have any recommendations? Any feedback is welcome.

 

Thanks,

 Matt.

phiberoptikphiberoptik

We dealt with a similar situation with having too many variations of Account Names and trying to prevent too many duplicates based on name variations. This does not specifically deal with your situation, but our solution was to create a custom object related to Accounts called Alias. Then we imported all known Aliases for our Accounts, then created a trigger and class that upon creation of an Account, the entire Alias object in Salesforce was searched for a match. If a match was found, the trigger would update the Account Name to the specific value that we wanted. So if we wanted 3M Company as the official name, the aliases might have been 3M Corp, 3M Co and 3M.

 

Now, for your solution, I would say you need to create a table for the trigger/class to reference (you referred to it as a .csv but it will need to be built into the code or accessible by the code). I am not a developer so I cannot explain exactly how to do that, but ultimately you are creating a legend for the class to scan and use a trigger to do the updating.