I'm trying to work with some information out of our enterprise system to create an employee directory, and I have a question regarding how I can relate nodes together.

I have a content type called Employees, and it has a number of fields, including Employee ID, First Name, Last Name, etc.

I then have a content type called Positions, and it has a number of fields, including Employee ID, Title, etc.

I'm trying to figure out how I can link the Positions and Employee nodes together on the Employee ID field rather than the nid.

Any help would be appreciated. Thanks!

2 Answers 2


If you're looking for a relatively simple option, Entity Reference is probably best:

Provides a field type that can reference arbitrary entities:

A generic entity reference field Four widgets: Two implemented on top of the Options module (Select and Radios/Checkboxes), Two autocomplete widgets (one with one text field per entry, one tag-style with comma-separated entries in the same text field) Two formatters: A "Label" formatter, with optional link that displays the label of the referenced entity (the node title, the user name, etc.) A "Rendered entity" formatter, that renders the references entity using a configurable view mode Integration with Views (for both forward and backward references) Integration with Entity Metadata (and as a consequence with Search API and the like) Integration with Devel generate Integration with Feeds and Migrate (>= 2.3) for painless data import


To set up the view as described in comments:

  • Create the view for Employee Content Type, and make settings how you desire
  • Add a Relationship to Entity Reference: Referenced Entity for the entity reference field, Require this relationship

Now you have access to the fields in the referenced (position) content type and can display them in your view. One thing of note, Title field may not work from Position, so you may have to include a separate field for the Position Title. Otherwise, everything should work as a normal view

  • Thanks, Geoff. I can't seem to figure out how to get it to work off the Employee ID field. I can get the reference hooked up, but it references the Node ID, if that makes any sense.
    – Pete
    Commented Jun 16, 2015 at 23:26
  • that does make sense, that's what it's supposed to do. Once you have a relationship between the two, you can access information between them. You won't get a direct relationship between the ID and a node, that causes too many potential issues - the next step is: how do you want to access or relate the data? You tagged your question with Views, but don't give any further information on how you want it displayed in Views
    – Geoff
    Commented Jun 16, 2015 at 23:44
  • I would like to build a view that combines information from both content types... for example, I'd like to display a list of people in the organization, and under their name, list their job titles.
    – Pete
    Commented Jun 16, 2015 at 23:57
  • see my edit....
    – Geoff
    Commented Jun 17, 2015 at 0:43

Try Views Cross Join

Allows to cross join entities in Views. This is an essential tool to bring in not related data. For example you want to display two nodes in the same row, but there is no reference between them. Then you could cross join all nodes. Important all nodes get joined in, so you need to limit the result with filters and arguments.

You should also put an index on the fields being joined on the database for performance reasons.

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.