Pass Record ID into unique URL for a page?

I have a button on a list detail page that opens an AirTable Form. I’m dynamically changing the URL to pre-fill the AirTable Form with the user’s info.

I’m wondering if I can do the same with the list detail page? For example, I’d want to pass the Record ID of the page into the AirTable Form as pre-filled.

Let me know if this makes sense… Thanks!

Hey,

Please have a look on this Help Doc to check the options you can use to prefill your form: Custom Form - Softr Docs

Regards,
Marine

I think I understand what you’re asking, and if so, it’s definitely possible. If you’re trying to pass the record ID into an embedded form, it’s pretty simple, and I have steps below. If you’re trying to pass the record ID into an outbound URL, though, that’s trickier and I haven’t figured it out yet, either. But here’s what I do have, if any of it’s helpful:

  1. First, you need to actually get the record ID of the page. This community post by @artur contains the JS code you’ll need to actually pull that information, and it should be inserted inside script tags in Page Settings > Custom Code.
  2. If you’re sending this data to an external link, rather than an embedded form, what I think you need to do then is add an event listener that will a) take that record ID, and b) append it to the outgoing link. I found this Stack Exchange post that I think looks promising, but I haven’t been able to get it to work, so who knows at this point.
  3. If you’re instead sending the record ID to an embedded form, it’s a little different. This post (also by the awesome @artur) gives you a script for how to pass logged-in user data into an embedded Airtable. However, it’ll have to be modified a bit, because you’re trying to pass a record ID, rather than logged-in user data. Instead of using window['logged_in_user']['softr_user_email'], you would instead use recordId, which we collected in step 1.
  4. From there, you can use collect the record ID in Airtable; just be sure to name the Airtable field identically to how you labeled the referrer

As I said, I haven’t yet figured out how to pass the record ID into an outbound URL (if anyone has, let me know!), but if you’re trying to pass the record ID into an embedded form, then steps 1, 3, and 4 are sufficient. For the record, here’s how I set up a Tally form using the steps above.

  1. JavaScript code I used, which I then inserted in a custom code block
  2. The hidden field I created to capture the record ID
    Screen Shot 2022-04-26 at 11.27.56 AM

Thanks @adalys for outbound link with recordId can you pls share what’s the scenario ? should be easy I think to add an ID