Passing user's logged in data to embedded Paperform

Similar to @Ezra 's code for passing data to an embedded Typeform form, I’ve changed it slightly so it works for an embedded Paperform form.

<script>
if(window['logged_in_user'] && window['logged_in_user']['softr_user_email']) {
nameData = 'name=' + window['logged_in_user']['Name']; 
emailData = 'email=' + window['logged_in_user']['Email'];
useridData = 'userid=' + window['logged_in_user']['userID'];
hiddenFields = nameData + `&` + emailData + `&` + useridData;

document.writeln(`<div prefill="`+ hiddenFields +`" prefill-inherit data-paperform-id="FORM_ID_GOES_HERE"></div>
`); 
}
</script>

<script>(function() {var script = document.createElement('script'); script.src = "https://paperform.co/__embed.min.js"; document.body.appendChild(script); })()</script>
3 Likes

Thanks for that! Very useful!

Thank you very much @datom for sharing it with us!

Thanks for sharing this! I have a question for @datom - as I’m reading through the embed code that you provided, I’m trying to figure out what data you can get (and then use) in the Paperform script.

Would I be able to get a bit of data that is stored in the user data that is synced in Airtable? In my AT user table, I have a field “Vet Code” that I use in the Paperform ID. Is that possible to get that data and pass it in using this code?