Answers.Body: <p>What could work for you is to get the events for each field separatly:</p>
  
  <pre><code>{% set firstEvents = craft.entries.section('events').relatedTo({
      element: user,
      field: 'firstEntriesField'
  }) %}
  
  {% set secondEvents = craft.entries.section('events').relatedTo({
      element: user,
      field: 'secondEntriesField'
  }) %}
  </code></pre>
  
  <p>If you need them combined in one loop, I can't think of another way other than to query x + 1 times:</p>
  
  <pre><code>{% set allEvents = craft.entries.section('events').relatedTo({
      element: user,
  }) %}
  
  {% set firstEventsIds = craft.entries.section('events').relatedTo({
      element: user,
      field: 'firstEntriesField'
  }).ids() %}
  
  {% set secondEventsIds = craft.entries.section('events').relatedTo({
      element: user,
      field: 'secondEntriesField'
  }).ids() %}
  
  {% for event in allEvents %}
      {% if event.id in firstEventsIds %}
          {# Event related through firstEntriesField #}
      {% elseif event.id in secondEventsIds %}
          {# Event related through secondEntriesField #}
      {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-14T06:10:48.963Z
Answers.LastActivityDate: 2015-08-15T20:05:25.310Z
Answers.LastEditDate: 2015-08-15T20:05:25.310Z
Answers.UserDisplayName: carlcs
Body: <p>If I’m finding all the entries that are related to a user, how could I get the field handle that the found user is referenced from?</p>
  
  <pre><code>{% set events = craft.entries.section('events').relatedTo(user) %}
  {% for event in events %}
  
    {# What goes here? Hypothetical code based on non-existent method would be: #}
  
    {% set field = craft.fields.relatedTo(user) %}
    {{ field.title }}
  
  {# Obviously this isn't possible. Any way to accomplish something like this? #}
  
  {% endfor %}
  </code></pre>
  
  <p>There are multiple users fields in the found entries, and there will be different logic depending on which field the user is found.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-14T01:02:15.127Z
Comments.Text: Possible duplicate http://craftcms.stackexchange.com/a/720/101
Comments.UserDisplayName: Mark Busnelli Jr
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-14T01:05:58.023Z
Comments.Text: @MarkBusnelliJr Not quite, the main question here isn't how to find the related entries, but how to find & display the field handle that the relation is referenced.
Comments.UserDisplayName: Chase Giunta
Tags: <relations><field>
Title: Find entries related to user and display field name
ThreadText: # Find entries related to user and display field name
  
  (Asked by: username_0 on 2015-08-13)
  
  If I’m finding all the entries that are related to a user, how could I get the field handle that the found user is referenced from?
  
  ```
  {% set events = craft.entries.section('events').relatedTo(user) %}
  {% for event in events %}
  
    {# What goes here? Hypothetical code based on non-existent method would be: #}
  
    {% set field = craft.fields.relatedTo(user) %}
    {{ field.title }}
  
  {# Obviously this isn't possible. Any way to accomplish something like this? #}
  
  {% endfor %}
  
  ```
  
  There are multiple users fields in the found entries, and there will be different logic depending on which field the user is found.
  
  **Tags:** relations, field
  
  > **Comments:**
  > **username_1**: Possible duplicate http://craftcms.stackexchange.com/a/720/101  
  > **username_0**: @username_1 Not quite, the main question here isn't how to find the related entries, but how to find & display the field handle that the relation is referenced.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-08-14. Score: 4 | Accepted answer
  
  What could work for you is to get the events for each field separatly:
  
  ```
  {% set firstEvents = craft.entries.section('events').relatedTo({
      element: user,
      field: 'firstEntriesField'
  }) %}
  
  {% set secondEvents = craft.entries.section('events').relatedTo({
      element: user,
      field: 'secondEntriesField'
  }) %}
  
  ```
  
  If you need them combined in one loop, I can't think of another way other than to query x + 1 times:
  
  ```
  {% set allEvents = craft.entries.section('events').relatedTo({
      element: user,
  }) %}
  
  {% set firstEventsIds = craft.entries.section('events').relatedTo({
      element: user,
      field: 'firstEntriesField'
  }).ids() %}
  
  {% set secondEventsIds = craft.entries.section('events').relatedTo({
      element: user,
      field: 'secondEntriesField'
  }).ids() %}
  
  {% for event in allEvents %}
      {% if event.id in firstEventsIds %}
          {# Event related through firstEntriesField #}
      {% elseif event.id in secondEventsIds %}
          {# Event related through secondEntriesField #}
      {% endif %}
  {% endfor %}
  
  ```
  
  
  ---
  
  