Help

Cannot programmatically delete records in airtable

Topic Labels: Extensions
Solved
Jump to Solution
4895 13
cancel
Showing results for 
Search instead for 
Did you mean: 
Fredrick_Esedo
5 - Automation Enthusiast
5 - Automation Enthusiast

I have table with 3 fields name (lastname,firstname, email). id seems to be auto incremented in airtable.

Now am trying to programmatically delete records but its not working

here is the code

//table.deleteRecordAsync(record);
//table.deleteRecordsAsync([record1, record2]);

1.) delete records where id is = 1

   import {initializeBlock, useBase, useRecords, createRecordAsync, updateRecordAsync, updateRecordsAsync, table} from '@airtable/blocks/ui';
   import React from 'react';
    import {base} from '@airtable/blocks';
    const first_tab = base.getTableByNameIfExists('myfirst_table');
    const ok = first_tab.deleteRecordsAsync({id: '1', fields: {'lastname': 'Carrots-2','firstname': 'joy-2', 'email': 'joy-2@gmail.com'}});
    if(ok){
    alert('records Deleted successfully');
    }

2.) delete record where id is = 1 and email is = john@gmail.com

const first_tab2= base.getTableByNameIfExists('second_table');
    const ok = first_tab2.deleteRecordsAsync({id: '1', 'email': 'john@gmail.com', fields: {'lastname': 'Carrots-2','firstname': 'joy-2', 'email': 'joy-2@gmail.com'}});
    if(ok){
    alert('records deleted successfully');
    }

The codes is not working can someone help me out. Thanks

13 Replies 13

Thanks. its working now. you are the best in the world Mr. Kamille.

I try updating now as I posted here and see how it goes.

Thank you

Glad everything’s working.

(Also I’m a woman lol)

Thank You Lady/Madam Kamille

@Kamille_Parks Please My record updates works with id but does not work with lastname. please help. Issues with updating records

Thanks