0

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.

1 Answers1

0

According to NetSuite, Async for AfterSubmit only works during Webstore Checkout? I am assuming that is the case? I haven't done Async AfterSubmits. You could try await on one of your log.debug see if it returns value? Async / Await is a promise so you will need to wait for your promise to be resolved first.

async function afterSubmit(context) {

  await log.debug("TotalTax", context.newRecord.getValue({ fieldId: "taxtotal" }));

};
Nukedd
  • 28
  • 5