Jan 13, 2021 10:48 AM
I have a CONTACTS Table and a linked INTERACTIONS Table.
I would like a button in the Contacts Field that creates (and opens for editing) a related record in the INTERACTIONS Table with the Contacts name and today’s date in the Date Field pre-populated.
My assumption is I need to write a script and then have the button run the script. I know how to do the second part but don’t know how to write the script.
Any help would be appreciated.
Jan 13, 2021 11:00 AM
Yes, you would need to script this if you wanted a button field to trigger this, because for some odd reason, Airtable doesn’t allow buttons to trigger automations.
However, if you’re okay with triggering this with a checkbox field, then you wouldn’t need to script this. You could just check a checkbox field, and use an Airtable automation to do this for you.
Jan 14, 2021 08:55 PM
Scripting app is not able to open a record for editing. At best it can create a link that you would have to click to open the record for editing. An automation could create a new record, but definitely could not open it for editing.
Another option is to create a form in your Interaction table, and have a button field in your Contacts table that opens the form prefilled with the contact and the current date.
If you have a Pro workspace, you can use my Prefilled Forms app to create the formula for the button field.
Jan 14, 2021 09:56 PM
@Brite_Admin Oops, I didn’t notice the part about “opening the record for editing”! Yes, as @kuovonne clarified above, that part of your request would not be possible with a script — but that is a very clever workaround to use a form!
Also, @kuovonne, that is a very cool & useful marketplace app that you created for making it easy to create pre-filled form URLs! I love it!! Kudos to you!! :cowboy_hat_face: :raised_hands:
Here’s another workaround that would require creating YET ANOTHER button field. After your automation runs that creates the new record in your interactions table, you can grab the RECORD_ID of that particular interaction record. Then, you could construct the URL for that interaction record, and put it into a URL field back in your contacts table. Then, your new button field can perform an “open URL” action by using the value of that URL field.
Jan 17, 2021 11:36 AM
Thanks for the suggestion. The Prefilled form will ALMOST meet my needs but wondered how I can:
Pre-populate the name of the person creating the interaction into a who created" Field in the interactions table. (I’m thinking that is not possible but hope I am wrong).
Pre-populate the Name of the person in the contacts table. I tried to do it using the Prefilled Form App but it is not filling it in. I am guessing it might be because it is the “Related Contacts” Field needs to be a Multiselct because I want the ability to add additional contacts to the same interaction. If that is not why it isn’t working, can you steer me on how to do it. If it is the cause, is there any workaround?
Jan 17, 2021 02:11 PM
This is not possible with only button field, as the button cannot detect who the current user is. The closest workaround would be have a different button for each person, and have each person click only his button. If each person already uses only his own views and you can hide other people’s buttons in the views, this may work, but it won’t work if multiple people share a view.
I don’t think that the problem is with being able to add additional contacts. I have prefilled forms that can accept multiple contacts.
The source of your problem depends on the setup of your base, the exact field types involved, and whether there are duplicates in the primary field.
Is the person field in your form a linked record field? Forms sometimes have difficulties prefilling linked record fields. If multiple records have the same primary field value, the form cannot tell which one you want to link to, and thus the prefill will not work. Special characters (like commas and quotes) in linked record fields also sometimes cause problems.
Is the person field in your original table (the one with the button) a lookup field? If so I recommend using a rollup field instead. Lookup fields and rollup fields behave very differently in formulas.
Nov 07, 2022 06:18 AM
I was looking for a button like this but ended up going with a checkbox that will easily trigger automations. I’m creating invoices and several line items within that open invoice record. Check the box, it creates a line item attached to the invoice and then unchecks it.