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

Hi Artur, maybe you can help with this. I have spent many many hours trying to find the solution.

Scenario:
I have a table with a list of agents inside of my softr application. The columns in the table include: A) Agents name B) Agents phone number C) agents email and D) a custom webhook URL that includes A, B, and C as hidden fields. All of the fields are stored inside of airtable. Column D is a formula that takes the webhookURL and adds A, B, and C as hidden fields.

When a user inside of my application clicks on the URL in the softr table, I need it to capture the current recordId of the webpage that the user is on (or even the whole URL, i don’t care which). Then it needs to pass this recordId (or the entire URL) into a webhook, so that the webhook contains A, B, C, and the recordID (or the whole URL). The real challenge for me is to capture the URL of the current page (or just the record ID of the current page) and then place this URL or the recordID into a webhook. Is this possible to do, and if so, how?

I have tried to copy and paste the code that you provided into the of the page where the softr table is located.

Any suggestions or help would be immensely appreciated!