NElliott
10/05/2023, 1:07 PMconst post = (data) => {
let nd = new Date();
log.debug({title: "In Time", details: nd.toISOString()});
async function doStuff(data){
try {
let fieldData = JSON.stringify(data);
let adbRec = record.create({type:'customrecord_3en_absence_data_bus'});
adbRec.setValue({fieldId: 'custrecord_adb_data', value: fieldData});
adbRec.save();
let od = new Date();
log.debug({title: "Record Id time", details: od.toISOString()});
} catch (e) {
let errorString = e.message || JSON.stringify(e) || 'No Meaningful Message';
log.error({ title: 'Oops!', details: errorString });
}
}
doStuff(data);
let od = new Date();
log.debug({title: "Out Time", details: od.toISOString()});
return true
}
Or, looking at what I've done have I made a rookie mistake?
I confess writing asynchronous functions is not something I do with any regularity so it's entirely possible I'm missing some salient point.Luiz Morais
10/05/2023, 1:14 PMerictgrubaugh
10/05/2023, 1:17 PMadbRec.save.promise()
instead, and not wait for it to complete? I have also seen and built what Luiz says as well; Restlets just ingest a staging record, and a M/R regularly processes them.NElliott
10/05/2023, 1:18 PMerictgrubaugh
10/05/2023, 1:25 PMNElliott
10/05/2023, 1:26 PMAnthony OConnor
10/05/2023, 1:32 PMNElliott
10/05/2023, 1:36 PMNElliott
10/05/2023, 1:36 PMNElliott
10/05/2023, 1:36 PMNElliott
10/05/2023, 1:37 PMMatt Carter
10/05/2023, 1:37 PMNElliott
10/05/2023, 1:38 PMNElliott
10/05/2023, 1:38 PMAnthony OConnor
10/05/2023, 1:40 PMNElliott
10/05/2023, 1:41 PMAnthony OConnor
10/05/2023, 1:41 PMMatt Carter
10/05/2023, 1:42 PMAnthony OConnor
10/05/2023, 1:42 PMAnthony OConnor
10/05/2023, 1:43 PMNElliott
10/05/2023, 3:25 PMShawn Talbert
10/05/2023, 3:27 PMNElliott
10/05/2023, 3:29 PMShawn Talbert
10/05/2023, 3:55 PMShawn Talbert
10/05/2023, 3:56 PMNElliott
10/05/2023, 4:08 PMAnthony OConnor
10/05/2023, 5:14 PMAnthony OConnor
10/05/2023, 5:15 PMAnthony OConnor
10/05/2023, 5:18 PMNElliott
10/06/2023, 8:26 AMerictgrubaugh
10/06/2023, 1:42 PMFred Pope
10/06/2023, 1:57 PMShawn Talbert
10/06/2023, 3:03 PMlog()
calls if the logs are below the loglevel threshold. Furthermore, for client scripts, it automatically logs to the console by default, making no round-trip calls to NS for logging.