Prefill linked record in form by record ID

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{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

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

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 …

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…

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

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.

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).

What is the exact syntax to make this happen?

I tried using this link:{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.

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.

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

Yes, I do, but for the fact that I use the template string {record_id}, not an actual, literal record ID, i.e.:{<form ID>}?prefill_{<field name>}={record_id}

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.

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

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.

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:

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:

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

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

Thank you both for your input! I also tried replicating what @Martin_Kopischke described and get the literal record ID.

Martin, could you share a dummy base that or screenshots showing your form A to form B in action? I have this exact need and would love to be able to leverage your great solution. Thank you!

Just do document my workflow: I have

  1. a form A for a bookings table that needs a linked entry taken from a project table. If a matching project is not found, the label for the field in form A instructs users to open form B (by clicking its link; you can see the label and link in the 4th screenshot) to enter a new project:
  2. form B is configured to redirect to form A with a prefilled project ID using the prefill syntax and the form redirect on submission functionality:
  3. adding the test project not found in the first screenshot in form A and submitting:
  4. results in a successful prefill of the linked project field in form B:

That is all there is, really, and it worked just five minutes ago while I took the screenshots for this demo. NB: I am on a Pro account, not sure if that makes a difference.

1 Like