<p>Actually saw that earlier in the documents: <a href="https://docs.solspace.com/craft/freeform/v3/overview/relations.html#overview" rel="nofollow noreferrer">https://docs.solspace.com/craft/freeform/v3/overview/relations.html#overview</a></p>

CC BY-SA 4.0
2019-10-16T03:12:53.443Z
reading now but this looks really promising ... amazing how i can miss stuff like that even after reading docs/google/etc ... thanks!
Erant
CC BY-SA 4.0
2019-10-15T23:02:32.377Z
2019-10-15T23:02:32.377Z
mmc501
<p>I'm using FreeForm and need to create a relationship between form submissions and the user that submitted them.  </p>

<p>To accomplish this I created a hidden variable on my form called userId.  I use overridesValues to set the userId to the current user before I render the form.  This "feels" wrong to me .. is there a better way to do this?   Is this userId already stored in the freemform data model (making what I'm doing uncessesary)?</p>

<pre><code>{% requireLogin %} {#check user is logged in #}
{{ craft.freeform.form("employeeForm", {
  overrideValues: {
    userId: currentUser.id,
  }
}).render() }}
</code></pre>

<plugin-freeform><solspace>
What is the correct way to attribute FreeForm submissions to users?
# What is the correct way to attribute FreeForm submissions to users?

(Asked by: username_0 on 2019-10-15)

I'm using FreeForm and need to create a relationship between form submissions and the user that submitted them.  
To accomplish this I created a hidden variable on my form called userId.  I use overridesValues to set the userId to the current user before I render the form.  This "feels" wrong to me .. is there a better way to do this?   Is this userId already stored in the freemform data model (making what I'm doing uncessesary)?
{% requireLogin %} {#check user is logged in #}
{{ craft.freeform.form("employeeForm", {
  overrideValues: {
    userId: currentUser.id,
  }
}).render() }}

**Tags:** plugin-freeform, solspace

---

## 1 answers

### Answer by username_1 on 2019-10-15. Score: 1 | Accepted answer

Actually saw that earlier in the documents: <https://docs.solspace.com/craft/freeform/v3/overview/relations.html#overview>

> **Comments:**
> **username_0**: reading now but this looks really promising ... amazing how i can miss stuff like that even after reading docs/google/etc ... thanks!  

---

