Prefill linked record in form by record ID

#1

I am very glad Airtable has added options to the possibilities for prefilling forms, especially the ability to prefill linked records. However, it seems this functionality expects the record index string as the prefill query parameter. I’m happy to have someone point me to the right way to do this if I am mistaken, but if I am not, I would find it very useful to link records by record ID. This would make scenarios like this possible:

  1. enter the One part in a One to Many data relationship in a first form;
  2. redirect the first form to https://airtable.com/formForManyPart?prefil_link={record_id} on success;
  3. enter one Many part correctly linked to its One.

Our exact usage scenario is to allow students to request resources for a project, with the ability to add the project to our DB first if it does not exist yet. Having that newly created project linked straightaway to the requested resources in the form would take away a lot of friction.

1 Like
#2

I think you’ve run into the same issue that tripped me up recently. I spent a while trying to troubleshoot syntax and the like before the problem finally dawned on me.

Prefilled linked records in a form are subject to the same limitation as non-prefilled linked records: Namely, they must reference an existing record in the target table. If you prefill the linked record with a value that does not correspond to a record in the target table, the linked-record field in the form does not show the prefilled value; instead, it displays the ‘+ add’ prompt indicating the user should select a linked-record from a list of existing records. Your feature request, then, is probably better described as ‘allow a linked record to be created from a form’ — which would be handy, but which I suspect would potentially cause so many other problems I doubt we’ll ever see such a thing implemented…

1 Like
#3

Thanks for chiming in (and I appreciate all the sterling work you are doing on this forum), but I wasn’t asking about creation of linked records in a form; I am aware of the fact that is not possible (yet), and was in fact trying to work around it when I hit the snag leading to this post.

I might have been unclear in what I described above (my apologies, English is not my native language), but my scenario involves two forms: I first create a record in form A, then redirect to form B with the newly created record A prefilled by using Airtable’s automatic redirection on form submission feature. By definition, the new record does exist in the target table at the point we reach form B because the redirect only happens on a successful submission of form A, in which the record was created, and the redirect URL does in fact contain its record ID; it just does not work with the prefill syntax …

#4

Oh, got it: The post-submission redirect allows you to redirect to the newly created record, but you want to redirect to a second form with RECORD_ID() as a prefilled URL variable. Yeah, that sounds like a use case no one would have predicted :slight_smile: — but, as you note, potentially quite a useful one. Thanks for taking the time to explain what you are hoping to accomplish. Upon re-reading your first post, it’s quite obvious; I suspect my initial reading was colored by the dance I had just gone through in trying to debug my own problem…

#5

Just a heads up: Airtable has quietly implemented this, pre-filling forms by record ID does now work. Thanks and kudos to the team.

1 Like
#6

It would be great if you could give an example o how to accomplish this. Can’t seem to find anything across the airtable support.

#7

You will find all about that in the original post, including a link to Airtable’s form prefill syntax and the string to be used (just replace formForManyPart by the ID given in the link you use to share your target form).

#9

What is the exact syntax to make this happen?

I tried using this link:

https://airtable.com/{form_characters_that_airtable_gave_me}?prefill_{fieldname}={record_id_that_airtable_gave_me}

The form showed up perfectly fine, but it just typed in the actual record ID characters into the field that I specified.

And upon submitting the form, it still created a brand new record.

#10

That is odd. It works in my case when I use the {record_id} template string as prefill data in the redirect URL you can indicate for a form submission (see above for how I use it to bounce between two forms). Not sure if Airtable special cases this scenario or if the record ID syntax that template stands for is not quite what I would expect it to be, but as I said, the specific scenario I outlined does work, while it did not when I originally posted.

#11

Thanks, @Martin_Kopischke. Are you using the exact same URL syntax that I posted above? Can you post the syntax you’re using?

#12

Yes, I do, but for the fact that I use the template string {record_id}, not an actual, literal record ID, i.e.:

https://airtable.com/{<form ID>}?prefill_{<field name>}={record_id}
#14

That won’t work, because Airtable wouldn’t know which specific record ID you’re trying to connect with.

I just tried it for the fun of it, just to see what the results would be, and as expected, it just typed in the literal words {record_id} into the field.

But hopefully someday, Airtable will give us this ability to prefill form fields with field information!

In the meantime, we’ve got a few 3rd-party tools to do this for us, such as FormNano.

#15

Oh, never mind. I think we are both trying to do completely different things. Lol.

#16

Yeah. The template string works if used as the redirect link form a newly submitted record. Not as a direct parameter in any other situation, obviously, for the reason you named.

#17

Right, sorry, I was trying to do a completely different thing than you! But it is very cool to know that what you are trying to do now works in Airtable! :slight_smile:

#18

OMG, I just tried your scenario – I used your syntax as the redirect link for a newly submitted record through a form – and it still didn’t work for me!

Airtable simply dropped the newly-created record ID (which ended up being “recNTeGHBeEPxpdlk”) into the specified field after redirecting. Lol!! :sweat_smile:

So I still can’t even get it to work, even when I follow your instructions! But that’s okay, because I don’t need this functionality for my own needs.

I’m just glad that it’s working for you, though! :slight_smile:

#19

Odd, I tested it again after reading your last post and it still works fine for me. I wonder what we do differently?

#20

Hmmm… not sure… maybe an Airtable employee will drop in here and enlighten us! :slight_smile: