I created an user event script to get taxtotal for sales order from AfterSubmit, but I am getting blank value from it. It's not processed before I receive the data, is there a way to await for the value?
async function afterSubmit(context) {
log.debug("Start Record", context.newRecord);
log.debug("TotalTax", context.newRecord.getValue({ fieldId: "taxtotal" }));
if (context.type !== context.UserEventType.CREATE) return;
const record = context.newRecord;
if (record["type"] == "salesorder") {
log.debug("Intial Run", record);
}
}
I am expecting an non blank value.