May 27, 2020 12:23 AM
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
Solved! Go to Solution.
May 27, 2020 04:26 PM
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
May 27, 2020 04:35 PM
Glad everything’s working.
(Also I’m a woman lol)
May 27, 2020 04:37 PM
Thank You Lady/Madam Kamille
May 27, 2020 05:35 PM
@Kamille_Parks Please My record updates works with id but does not work with lastname. please help. Issues with updating records
Thanks