how to replace title field with some other field in entity reference field list?
Create a view and add the Title and Code fields.
Add an Entity Reference display to your view. In the View edit page, under the Settings for the Format: Entity Reference list, check one of your fields.
On your City content type, under the Country reference fields settings, change the target type on the Mode field under Entity Selection to View: Filter by an entity reference view. After selecting, the fields in that fieldset should update making your newly created view available under the View used to select the entities field. Select your view and save the fields settings.


Your dropdown should now have your Title and Code fields.