Create an Airtable Script (without knowing code)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you don't know how to code but you want to take advantage of air table scripts look no further than this video i'm going to be going step by step into the steps i take every time i implement a script and coming from a non-coder like me this is a big deal so if that's of interest stick around and let's get into it hey my name is gareth pronovost i am the owner at gap consulting where we help you to organize and automate your business and life if that's of interest and you want to learn more about how we do that swing by our website i will include a link below this video check that out and don't miss our airtable crash course it is a free crash course that will get you up to speed quickly and easily with airtable but that being said let's just jump into the heart of this video and before we get into how i set forth a script or how i how i go about putting a script in motion i have a confession a lot of people might not know this but i am actually a notoriously bad coder i'm very very comfortable when it comes to building formulas inside of airtable because in my opinion they're very similar to excel and i was quite comfortable writing formulas in excel before i made the switch that being said that does not necessarily in my mind at least equate to being good at code i don't know how to write java and i feel like i need to be really upfront with that because first of all none of the code that i'm going to use in this video is my own and second of all i want you to know that if you're not a competent or a confident coder that this is doesn't mean that you can't build some awesome stuff using airtable scripts so if that's of interest we're just going to jump right in here in my on my screen you're going to notice that i have a pretty straightforward table i've got three different things i've got clients so we've got a table of contacts right this is pretty standard stuff we would normally keep first name last name email address address all those you know pieces of information that are relevant to our uh the people that we uh do business with then those people of course link to orders so in this case i'm saying well i've got an a formula that's generating the auto an auto number for the formula if you're curious about how to do that by the way run a little autonumber this is going to create a new number for every single record and then you can just add a static number to it like in this case 1 1 1 0 plus the auto number it's going to produce a unique record id every time or a unique order number every time i'm also tracking other things like what's the amount of this order what's the date of the order and then we've got that linked relationship to clients right like who put this order in uh but then the part here where this is getting kind of cool is when then we say hey an order consists of multiple hours in this example now this is different of course for every different company but i'm imagining a situation where a company might sell blocks of time so you might pay for like consulting hours and if you buy a lot in bulk you might get a discounted rate or something along those lines i was looking for this kind of a solution the other day when i was doing some work on one of our internal databases and i stumbled upon this and i just thought i needed to share it so basically the idea is an hour is created one or more hours are created and linked back to that order so if i were to do this manually for example i could say okay uh keanu reeves put an order in he paid us 750 bucks and maybe he bought six hours well i'd have to create those hours manually so i'd have to create an hour and say no it wasn't order one one one two it was one one one three let's link to the right order then it moves it down and then i would have to come down and i'd have to hit you know enter enter enter or shift enter to get the number of orders that he put in and then if i didn't want to stare at all of these all opened up you know i'd have to you know shrink them down and you can see that every time we do anything like this manually there's a big margin or a big room for potential error and so i don't like to do it manually and that's why i went looking for a script that could handle this for me so that's the scenario but i want to you know again paint this picture where i'm not comfortable with code i didn't write any of this from scratch so what do i do well the first thing i do is i go onto the google and i just start searching and one of the first things that came back when i was looking for this i searched for how do i create a button that will automatically link to multiple records in airtable it was a long search there's a little bit of uh of combing around to do but lo and behold i will almost always stumble upon something from the air table community and i point out that this all starts with the airtable community because i think it's really important to point out that the airtable community is incredibly supportive of itself uh there are people on the community that are putting forth a lot of really cool code making it available and just putting out resources and assistance and helping one another to you know really leverage the true power of air table it's a really cool place and if you're not active there i'd certainly recommend at least checking it out because you can find a lot of answers here anyhow you can see that uh matthias has uh posted this you know some some time ago about asking about this very problem you know he's asking how do i you know make a button that adds projects under you know my my table etc and you can see that there are actually quite a few answers here here uh one coming from camille who's a fantastic uh advocate of airtable and code if you ever find her on the forums definitely uh you know follow her and and pay attention to what she says shout out to camille um but the one that really struck me was this one posted here by mike i tried all of these and i really liked the code that mike put together here so tip of the hat mike if you watch this thanks so much for the code this was super helpful i also feel comfortable using it because he's put forth this little copy right here in the chat or in the comment uh basically saying go ahead and use this it's granted free of charge uh you know he's not trying to make any money off of this little script thanks so much for that mike and uh and yeah let's let's grab it so basically what i do is i just grab this whole thing and i do a control c now i've already created this script inside of my database but i'm going to pop open the apps here remember airtable rebranded its blocks they are now apps and you can see that i did have this here previously i'm just going to ditch this and we're going to start over from scratch i'm going to install an app and i'm going to go to that scripting block or scripting app sorry old habits so then install from here and that is going to put this in now you can start with a lot of these things that airtable has already given us some templates around in this case though i don't need that because i already grabbed the core script that i'm going to be using so i can just say start from scratch and i'm going to highlight all of the text that's in here and i'm just going to paste that that uh code that i already copied now really quickly if you're not really familiar with code when you see this uh this slash here and this this text here is slightly grayed out and it has these asterisks before it this is telling us that these are comments that were left in the code this is not actually going to do anything when the code runs it's really here for us when we're reading in the code itself so you know mike's kind of covering his all bases here and saying hey the software is provided as is uh pretty standard you know stuff here in terms of making sure that he's not held liable for anything that breaks so then he's gone in here and told us really what the script is and he's left us some notes for what you can do to change this script and make it work for you in this case you might notice that he mentions that the script prompts for every uh for an input every time it's run for some users one or more of the values may be the same with every execution and so in those cases you can come into this hard code area and actually hard code those pieces so i'm going to pause right here i'm going to pop back into my database and my parent database might excuse me my parent table in my database is the orders table so i want to create a parent relationship from orders that creates multiple hours in the hours table so parent is orders hours is the child and so that relationship is going to be consistent every time right i want to be able to say every time i run this script that's what i want to have happen one order leads to multiple hours and then inside of hours i want to link them to orders here so quick pause this orders is the name of the field this orders is the name of the table and that's important for when we go in here and play with this code a little bit so let me pop that code open again the parent table if you recall is orders we have to get this verbatim i believe that uh capitalization matters so double check your work here and then child table is hours for us and the link field name is also orders remember there's a delineation between the two i should have probably given them a different name just so we knew which was which so that's it for this now i want the record count to vary every time i put in a new order meaning i want a flexible number of hours to be created so i'm not going to hard code the new record count i'm going to say i'm done editing and we're going to give this a test run so let's flip back into orders and i'm going to create a new order obviously it automatically gets an order number i have to give it a date we'll make it today and we can assign this to somebody let's say kristen bell put in an order of 900 dollars how many hours did she buy maybe she bought 10. i don't want to go in and manually create them let's see if we can get the script to do it for us i click run on the script and it's prompted prompting me for the parent record but you'll notice when i click parent record it's only showing me records in the orders table and the reason i really love this is because we've already told it hey our parent table is always orders so it knows that that's it's looking for a record in that table right and so i can now click that record select that and now it's asking us to tell it the number of records it wants to create and link to this order in this case i said i think 10 so we'll make it 10 and hit enter and just like that 10 records are created and linked to this order now i've never left the airtable environment this is entirely inside of my database and it's not using automation per se it's using a script that is doing these actions that we've told it to do and so here we can see that 10 records were created count 10 right there 10 records were created and attached back to the appropriate order now if i want to kick this up just a little bit more what i can do is create a button and i'm really really excited about this option within buttons so let's make a button that creates hours and we're going to make a button here and i can label the button to be whatever i want so it'll be make new hours and we can pick whatever style we like maybe i really like this uh this purple now for the action step i want to run that script and i have to tell it of course what scripts to run now if you haven't already put the uh script in your database of course you'd need to do that so install but in this case i already have this script so first i have to tell it what dashboard this is in so there is the capability of us to have multiple dashboards that hold different apps inside of our database in this case i only have the one dashboard so easy choice and i've only got the one script so again easy choice but once i have that all picked out just click save and now i've got this nice button it looks like the way i wanted to present it in this case with purple text maybe i actually want to have it little little uh a little blocked out there and when i push this button it's going to run the script specifically for this record so remember the first time that we did this we had to pick the record and then tell it the number of orders to create or the number of hours in this case i create a new order date of order let's make it again 10 1 this time maybe keanu reeves orders from us again pays us 800 now we need to make those hours maybe he paid for six hours i'm not sure once we hit that number we hit enter and you'll notice that this time i did not have to pick which record was going to be the one that i wanted to link against because thanks to this button now that script knows hey when i push that button i'm doing it for that specific record now to kind of go beyond that if we wanted to add more records to a pre-existing order we could do that by clicking here and now this time you see the parent record was changed to 1114 which is the button well as the record associated with the button i pushed we can add two more records hit enter and now if we pop back in here to hours we'll see that where we previously had 10 of these before one through ten now we've added these additional two so as you can see this is a pretty flexible script and just to kind of drive this all home i know very little about coding and so i just want to stress that where you know don't be afraid to jump into the airtable community and check out all the resources that people have put together there's so many excellent you know users out there who are trying to make more information available so again huge tip of the hat to both camille and mike for answering this question of matthias on the uh on the on the forum thank you so much to you and everybody else who's contributing all this awesome code because people like me wouldn't be able to do it without any of your help as always i hope you found that to be very helpful if you did and you'd like to learn more swing on by our website and check out all the resources we've put together we have a free airtable crash course that will get you up to speed quickly and easily in air table and we also offer some paid services including hourly consultations with our experts we have some online group coaching programs and courses and for the very advanced needs we can build a bespoke project for you from scratch so swing on by and i look forward to connecting with you soon you
Info
Channel: GAP Consulting
Views: 5,565
Rating: undefined out of 5
Keywords: airtable, gareth pronovost, airtable training, airtable consultant, airtable consulting, airtable demo, learn how to build automation, airtable scripting, create records by button in airtable, airtable record creation, push a button script, script button, airtable script block, script without knowing code airtable, airtable nocode, airtable script create and attach records
Id: cy-EDSSF9ac
Channel Id: undefined
Length: 15min 8sec (908 seconds)
Published: Thu Oct 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.