How to configure unique fields in Drupal feeds importer ?
Drupal feeds module provides the possibility to define SOME fields as unique fields when importing content (such as the Title field of a node for example). However, you might sometimes need to configure other fields as unique. Here is how you can do it, using the Field Validation module.
The Use Case
Let’s assume you are collecting contact data in user profile entities, using the profile2 module. You have an email field in your profile2 entity and you would like, when importing user profiles from a CSV file, this email field to be considered as unique. For Feeds, this email field is just a basic simple field and, by default, Feeds won’t provide you with the possibility to set it as unique. Here is how to do it.
Use the Field Validation module
- Download and enable the Field Validation module
- Enable the Field Validation UI module that comes bundled with the Field Validation module
- Go into Structure > Field Validation and add a new rule, with the following parameters (for the validator, select “Unique Values” and for the scope, select Bundle or Entity depending on what you need):
4. Go back to your Feeds Importer configuration, in the Mapping of the Entity: you will now be able to select your email field as Unique !
A simple procedure once you know about it, but it took me some time to find it, so I figured I would share it.
Originally published at https://www.gvj-web.com on August 22, 2013.