May 18, 2022 05:32 PM
Hey Community,
I need a hand to know if something is possible.
I can see using the automation and find records I’m able to achieve this for a single record but not multiple at once, is there something I’m missing or a simple script I could use to overcome this?
Any help would be appreciated.
May 19, 2022 04:55 PM
Absolutely love the support on these forums.
@Adam_TheTimeSavingCo thanks so much for putting this together but I don’t think it will work with my configuration. I’ll try and provide some more information with screenshots.
Table 1: This is a table where we map Product, Qty & Project for an order.
Table 2: Is a list of components that each Product needs to have shipped when leaving our factory.
Table 3: This is where we build a list/ledger of all the components.
What we’re actually trying to achieve with Table 3 is a packing list for our packing team which they can mark off as ‘Packed’ once its on a pallet shipped.
The crazy thing is that Airtable Automations actually can Find the correct information, it just cant create the multiple records at once. Which is a real shame because it would be a seamless solution.
Any help or tips would be awesome.
@ScottWorld I also appreciate your suggestion. I have added a screenshot of the current configuration in Make I have set up. Its more complex because of the 3 tables I believe (maybe I’m wrong). I’m just really keen to have the configuration in Airtable as Make is proving to throw to many errors and is very cumbersome to get working again.
Once again thanks for the support!
May 19, 2022 05:45 PM
Ah, hmm, okay, let me know if I’m understanding things right
And the thing you want out of this is a list that contains:
Is that right?
May 19, 2022 05:56 PM
@Adam_TheTimeSavingCo that’s absolutely correct.
Appreciate all the help!
May 19, 2022 06:53 PM
Roger that. Do you have a Pro account? And how comfortable are you with scripting?
I’ve been trying to figure out how we could accomplish this without automation scripting, and I think I’ve got something that might work but it’s so convoluted that I think we might just want to do this with scripting instead.
If we’re going down the scripting route, depending on how comfortable you are with scripting, I can just pass you code that you can modify as needed
If you’re not comfortable with scripting, private message me a link to a duplicate of your base with the sensitive data removed and from there I can put something together for you.
May 19, 2022 07:17 PM
@Adam_TheTimeSavingCo you’re an absolute legend.
I’m pretty new to scripting but keen to learn more, so happy to have a crack at implementing if you’re happy to share the script?
May 19, 2022 07:59 PM
What kind of error message are you getting in Make?
May 19, 2022 08:56 PM
Roger that, in that case, let’s use scripting to just create the records. We’ll use an automation task to find the data we need
Here’s what you’ll need to get started:
//input.config() allows you to grab data trigger / action preceding this automation script
let inputConfig = input.config()
//You should be in the Scripting action of the automation setup, and should see a column on the left. In there, we add a value called `matchingRecordIds`, where the dynamic value is the comma separated list of records found
let matchingRecordIds = inputConfig.matchingRecordIds
let tableToUpdate = base.getTable('Table 1')
let updates = matchingRecordIds.map(recordId => ({
"fields":{
//format:
//"[FIELD NAME]" : "[FIELD VALUE]"
//e.g.
//"Name": "New name"
//For link fields, the format is:
//"[FIELD NAME]" : [{id: [RECORD ID OF RECORD WE WANT TO LINK TO]}]
//e.g.
//"Thing": [{id: 'recKwiNgmGbihcSHN'}]
//or if you're passing in a value:
//"Thing": [{id: thingRecordID}]
//Examples:
//"Name": "New name",
//"Thing": [{id: 'recKwiNgmGbihcSHN'}]
}
}))
while (updates.length > 0) {
await tableToUpdate.createRecordsAsync(updates.slice(0, 50));
updates = updates.slice(50);
}
This is about as specific as I can make it with the information I have now; let me know if you need more help
May 19, 2022 10:46 PM
@Adam_C - thank you so much for this.
I’ve managed to get it to post blank records into Table 3. However, I’m using the ‘Find Records’ function in automations to filter the components from Table 2. I cannot get the script to post the actual text result. It will just write the text I set up in script.
Any suggestions?
May 20, 2022 03:37 AM
Hi,
You can create multiple items linked to your first table by single automation, putting their names comma-separated into link field. If name already exists, it links to it. If not, it creates new record and link.
I had scenario when first automation perform such ‘auto create’, adding words 'Create new ’ to guarantee that such record will not exist. And then second automation follows all records containing 'Create new ’ in name, and do other job, removing the phrase at final step.
In short, first automation ‘marks’ multiple N records, then second runs N times, for each record marked.
But it can’t be done when your primary field is formula. Some people even use formula in primary field to protect from new records creation, when somebody enters wrong name into link field.
Jul 31, 2022 09:45 AM
I am following this thread to set up an automation that is similar, but cannot seem to connect the dots.
I have Tables for Requests, Vendors and Invites.
When a new Request record is created for a particular Service (this is a selection field in the Request table), I need to find the Vendors who match the Service (also a selection field in Vendors table) and then create a new record in the Invites table with the Request and Vendor for each of the Vendors that match.
For example, a Request is entered for Service “Cleaning.”
I need to find all of the Vendors in the Vendor table that show Cleaning as a Service.
ABC Cleaning, Super Cleaning and Best Maintenance are matches.
Automation creates a new record for each match in the Invites table. The Request ID from step 1 is entered and the Vendor from Step 2 is entered, and each record has a Status field that must show “Invited.”
Currently, I can’t seem to get these to be entered as three separate records in the Invites table.
My experience with scripting is limited. I am wondering if you can help with this, as it seems to be fairly straightforward for someone with more experience!