[英]Netsuite User event script trigger before totaltax is written
我創建了一個用戶事件腳本來從 AfterSubmit 獲取銷售訂單的總計稅,但我從中得到的是空白值。 在我收到數據之前沒有處理,有沒有辦法等待價值?
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);
}
}
我期待一個非空白值。
根據 NetSuite,AfterSubmit 的 Async 僅在 Webstore Checkout 期間有效? 我假設是這樣嗎? 我還沒有完成 Async AfterSubmits。 您可以嘗試在您的 log.debug 之一上等待,看看它是否返回值? Async / Await 是一個 promise 所以你需要等待你的 promise 首先被解決。
async function afterSubmit(context) {
await log.debug("TotalTax", context.newRecord.getValue({ fieldId: "taxtotal" }));
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.