How to pass logged-in user data to embedded Airtable form

Some of our users wanted embedded Airtable Form with logged in user info

<script>
let airtableFormUrl = 'https://airtable.com/embed/shrr1bNRWSjmfmJJK8k??backgroundColor=red';

if(window['logged_in_user'] && window['logged_in_user']['softr_user_email']) {
airtableFormUrl = airtableFormUrl + '&Email=' + window['logged_in_user']['softr_user_email'];
airtableFormUrl = airtableFormUrl + '&Full%20Name=' + window['logged_in_user']['softr_user_full_name'];
}

document.write('<div class="w-100 text-center"><p class="h6"><iframe class="airtable-embed" src="'+airtableFormUrl+'" frameborder="0" onmousewheel="" width="100%" height="750" style="background: transparent; border: 0px solid #ccc;"></iframe></p></div>');
</script>
1 Like

@artur , I can’t use this script. I have an error message “Airtable n’autorise pas la connexion”. Any idea of the problem ?
Thank you.

@Virginie can you pls ping us on support chat so we can look into this error ? Seems it’s a generic one not specific to this script.

Is there a way to pass in Softr parameters like LOGGED_IN_USER:AT_RECORD_ID?

Attempting window[‘logged_in_user’][‘at_record_id’] and some variants on that does not seem to work.

I am trying to use a tally form after user sign up and send tally form data to airtable records. However, its not adding to the existing user record but creating a new record. Need help Screen Shot 2022-03-05 at 8.12.51 PM

Hello @shiizygy,

Do you mean the Airtable Embedded form or form in Softr?

Dear @ramureddy ,

Do you want the current record to be replaced when a new form is submitted?

Did I get right?

Hi Suzie, yes. that’s right. current record to be replaced when a new form is submitted.

I am using that data for profiles

Thanks,
Ramu

I am referring to an Airtable Embedded form (as discussed in this thread).

Hey,

It is not possible, unfortunately. A new record is being created when submitting a new form.

Sincerely,

You can save the Tally post datas in a other table and make an Airtable automation to update the record in the correct table.
Tell me if you need/want more informations about the Airtable automation.

@artur Is there anyway to refresh page or a block after submitting a embedded form?

Hi Nick! As we don’t have access to the embed’s content it’s very hard thing to do :frowning:

@shiizygy the example you shared has wrong quote character. For it to work quotes need to be like ' and not like ‘

Also feel free to share the url so we can check it.

FYI the query params in @artur’s script needs to have “prefill_” before each of the form field names as noted in the airtable docs here (maybe it’s been updated recently?).

Updated version here:

<script>
let airtableFormUrl = 'https://airtable.com/embed/shrr1bNRWSjmfmJJK8k??backgroundColor=red';

if(window['logged_in_user'] && window['logged_in_user']['softr_user_email']) {
airtableFormUrl = airtableFormUrl + '&prefill_Email=' + window['logged_in_user']['softr_user_email'];
airtableFormUrl = airtableFormUrl + '&prefill_Full%20Name=' + window['logged_in_user']['softr_user_full_name'];
}

document.write('<div class="w-100 text-center"><p class="h6"><iframe class="airtable-embed" src="'+airtableFormUrl+'" frameborder="0" onmousewheel="" width="100%" height="750" style="background: transparent; border: 0px solid #ccc;"></iframe></p></div>');
</script>
1 Like

If non of previous custom codes work, this one should work on React blocks

<script>
window.addEventListener('block-loaded-feature-grid1', () => {
    if(window.logged_in_user) {
            const name = window.logged_in_user.softr_user_full_name;
            $("span:contains('{LOGGED_IN_USER:NAME}')").removeClass('d-none');
            $("span:contains('{LOGGED_IN_USER:NAME}')").html(name);
    }
})

</script>
1 Like

Hi,

Sorry to dig this up but very confused about how to implement this. I can’t see how to change it for my airtable set up?