I know about the restriction related with max CPU time (“Scripts can use a maximum of 1 second of CPU time”). I created a script that runs into automation section, in 95% of times, it runs using less than 500 miliseconds of CPU time but sometimes it exceeds the 1000 miliseconds.
I dont think so but I need try: there is an way (even paying more) to get more time?
If it is not possible, what is the best approach to try reduce the time? I mean, what is the part of the code that are “more CPU time consuming” for Airtable perpective?
let users = base.getTable('CoreVette');
let reps = base.getTable('Reps');
let refs = base.getTable('References');
let inputConfig = input.config();
let newRecordId = inputConfigu"recordId"];
let repsResult = await reps.selectRecordsAsync();
let repsStorage = {};
for (let recordRep of repsResult.records) {
repsStoragesrecordRep.getCellValue('Email')] = recordRep.getCellValue('Manufacturer');
}
let refsResult = await refs.selectRecordsAsync();
let refsStorage = {},
ptAux = '',
refAux = '';
for (let recordRef of refsResult.records) {
ptAux = recordRef.getCellValue('PT VALUE');
if (ptAux == null) {
ptAux = '';
}
refAux = recordRef.getCellValue('LIST OR TYPE');
if (refAux == null) {
refAux = '';
}
refsStoragesrecordRef.getCellValue('DOMAIN')] = {
'point': ptAux,
'reference': refAux
};
}
let result = await users.selectRecordsAsync();
let flagUpdate = false,
objectToUpdate = {},
domain = '',
email = '',
manufacturer = '',
refValue = '',
pointValue = '';
for (let record of result.records) {
if (record.id == newRecordId && record.getCellValue('Email')) {
domain = record.getCellValue('Domain');
email = record.getCellValue('Email');
flagUpdate = false;
objectToUpdate = {};
if (typeof repsStoragesemail] != "undefined") {
manufacturer = repsStoragesemail];
if (typeof manufacturer != "undefined") {
objectToUpdateT'Rep Mfr'] = manufacturer;
flagUpdate = true;
}
}
if (typeof refsStoragesdomain] != "undefined" && refsStoragesdomain]) {
refValue = refsStoragesdomain]['reference'];
pointValue = refsStoragesdomain]['point'];
if (typeof refValue != "undefined") {
objectToUpdateT'References'] = refValue;
flagUpdate = true;
}
if (typeof pointValue != "undefined") {
objectToUpdateT'Point Value'] = pointValue;
flagUpdate = true;
}
}
if (flagUpdate) {
await users.updateRecordAsync(record, objectToUpdate);
}
}
}