Help

Re: How to transfer record to another table on meeting condition?

1273 0
cancel
Showing results for 
Search instead for 
Did you mean: 
mshah72
6 - Interface Innovator
6 - Interface Innovator

Is there any automation in which I can transfer the whole record as it is to another table when it meets certain condition?

Basically I have table 1 where once I click approved, the record should go to table 2. I am aware about the create a new record method were we can map all the data from table 1 columns to data in table 2 columns but I have nearly 100 columns and need to be done in 4 tables the same thing. It is very time consuming.

6 Replies 6

Scripting would allow you to do that without hardcoding the fields?  If not, the 'Create a new record" automation action is the way to go here

I'm curious about the business case that requires this though?  Instead of having the same data in different tables, the usual workflow involves all the data being in one table and using status fields and views to slice things up.  I take it that doesn't work for you?

HI @mshah72,

As Adam mentioned above, this would not be the best way to setup your database system.

Instead of creating different tables for the same record, you would want to keep the record in one table and create different "views" to filter your records in different ways.

You can learn more about "views" in this Airtable support article.

And, for a deeper dive into "views", you can check out my free Airtable training course, which you can take for free by signing up for a free 30-day trial with LinkedIn Learning.

Hope this helps! If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld

mshah72
6 - Interface Innovator
6 - Interface Innovator

Thank you @TheTimeSavingCo and @ScottWorld. So currently for each approver I have a table because I don't want the previous approver to be able to edit the record content once submitted. So we weren't able to use the view option.

Also, @TheTimeSavingCo I would like to understand how to do it with scripting. Thank you in advance. 

@mshah72 

You should probably explore interfaces — create one interface page where records can be edited when they're haven't been approved by the logged in user, and another interface page where the records can't be edited because they've been approved by the logged in user.

It's not good database design to delete records from one table simply for the purposes of adding them to another table. However, if you still wanted to go down that path, you would either need to write your own custom Javascripts for that, or you would need to use Make's automations for Airtable.

If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread.

For example, here is how you would instantly trigger a Make automation from Airtable. I also give live demonstrations of how to use Make in many of my Airtable podcast appearances here.

Hope this helps! If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld

Ahh, yeah that makes sense.  For the scripting side of things, you'd do a `table.fields` to retrieve all the fields in the table, filter out the calculated fields, grab the data, and then create the new record in the other table.  The main caveat would be that the two tables would need to have the exact same field names, if not it'd get really messy

Here's the API documentation: https://airtable.com/developers/scripting

Alexey_Gusev
13 - Mars
13 - Mars

Hi,
So, imagine you have automation, when record meets condition. Then follows script step, input value 'id' , where you pass record id.

The simple case is when destination table has all fields with the same names as in source, and their type is usual text (singleLine or multiLine). 
(it's ok if destination table have more extra fields, or if source fields having different type)

simple script to copy data is:

 

const src=base.getTable('Source')
const dest=base.getTable('Destination')
const rec=await src.selectRecordAsync(input.config().id)
const write=src.fields.map(f=>[f.name,rec?.getCellValueAsString(f)])
await dest.createRecordAsync(Object.fromEntries(write))

 

the rest (delete record in source, exclude some fields, write to other fields type etc) - refer to Examples and API in code editor window