Importing values replacement

Im new to SuiteCRM and I need to know is theres a way to change a field value when I do an import.
Let me give an example.

Im importing a list of contacts and the countries are estabished by code (US, AU, CL, BR, etc). I need to change this value to the country name after I do the import.

I can only think about doing a workflow but this is not very productive since I would have to make about 200 to cover al the countries.

Any help would be appreciated.

I’m sure there are ways to do it via code. But the simplest way to accomplish it is by modifying the file with the records before importing. Open it with excel, or your favorite software, and add an extra column, then manually add the proper name on that column.

That might take some time but will ensure all data is properly imported.

The other option is to import it the way it is and later do a direct substitution on the DB via SQL.

The thing is that I need to be able to do this without modifying the importing file.
In fact, let me rephrase my question.

Can I import this country codes and have a different field to “autofill” with the corresponding contry name? Or this could only be achived via code?


Then create a logic hook. It will give you more leverage on how to create your logic.

A before save logic hook can allow you to do direct substitution and you can use the same field.

Here the logic hook documentation:

Here a discussion regarding validations on logic hooks:

I will try that!


You can write function beforeImportSave for object Contact. For example:

function beforeImportSave(){
    $countries=array('US'=>'United States','AU'=>'Australia',...);  // write full array!!!
    $this->country= countries[$this->country];