We are importing contacts into our CRM. Our CSV file contains a District column, but while importing contacts, there's no such field present in CiviCRM--we need to add the district field.

URL: example.com/?option=com_civicrm&task=civicrm/import/contact&_qf_MapField_display=true&qfKey=7d325df8cb7e6a31c5c05551375c8292_1176

Screen Shot: http://screencast.com/t/lDQAjxPXlJsJ

So as shown in the screenshot, we want to add district under the state in the drop down. So there should be a column called "district" when we view the contact list.

Also, when we're importing contacts, it is showing mismatched files. Is there any way to put all my contacts in a file to import without interruption?

On the last step, it is importing only 145 contacts out of 250. It is generating an Import Error CSV file with second column (Reason) containing "Invalid value for field(s) : Addressee must be one of the configured format options. Check Administer >> System Settings >> Option Groups >> Addressee for valid values."

As I do not have enough experience in programming, please guide me on the simplest way to proceed.

2 Answers 2


You can add custom fields for district. Once you add the field you can map it in the import. see http://gitbook.civicrm.org/organising-your-data/creating-custom-fields.html for how to add the field.

I'm not sure just what district is in this case. If the addresses are for a foreign country that has district as part of the address, it may already sort of be there. It may be stored in state province field. If it is this case, you can see what's there by going to a contact, change the country and seeing what's in the pull downs. If you are importing addresses from some other country you may need to add a field for country to your cvs.

I'm not sure I fully understand the mismatched file problem. If you have both individuals and households in the same file you will get a mismatched contact problem. Then you need to either run the file twice. Once for individuals and once for households and ignore the errors or split the file into two.

The problem with the addressee is most likely picking the wrong field to map to. The addressee field is expecting a smarty clause, like {contact.first_name}{ }{contact.middle_name}{ }{contact.last_name}, which creates the addressee on the fly by using using the values in other fields. If you are trying import specific text to be the addressee then map it to "Addressee Custom". (The same is true for postal and email greetings as well).


It sounds like you're saying that "district" is the name for a division of a state or province. The American and English term for this is "county", and CiviCRM has built-in support for counties nested within their respective states. In some countries, multiple states will have a county with the same name--for example in the US, 18 states have a "Montgomery County", so CiviCRM knows to pick the right one once you pick a state (just like the process of picking a country and then a state/province).

You will need to do three things to get this set up. First, go to Administer - Localization - Address Settings, scroll down to Address Editing, and click the box for County. This will let you set counties for your contacts.

Second, you will need to populate counties. As long as I've known, CiviCRM has shipped with just a handful of counties, all in California. For a while, CiviCRM shipped with a SQL file with other American counties, but it was cumbersome for the average user to load them. Instead, I built an extension to load them--enabling the extension adds them all to the database.

If you have a list of all the districts for the country you're importing into, you can very easily build an extension to import them. Copy the extension that's in https://github.com/agh1/com.aghstrategies.uscounties and edit the array that has all the counties to have each item be the state/province id pointing to an array of the district names.

Alternatively, you could just go into the civicrm_county table in the database and enter each district with the corresponding state/province ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.