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

  1. Download and enable the Field Validation module
  2. Enable the Field Validation UI module that comes bundled with the Field Validation module
  3. 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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade