vincentkang
10/05/2022, 4:35 PMPromise
work in my RESTlet code. but it just does not work and I am not sure what i am missing.
I made the script that has a basic promise but then and catch clauses are ignored…
I wonder if the RESTlet is return the result without waiting for Promise
to either resolve or rejectvincentkang
10/05/2022, 4:36 PMconst savedSearch = search.load({id: savedSearchId});
savedSearch.run().each.promise(function (result) {
log.debug("Promise clause");
var name = result.getValue({name: 'name'});
log.debug("name", name)
return true
})
.then(res => {
log.debug("complete", res)
})
.catch(err => {
log.debug("fail", err)
})
This is what I got from Netsuite docs.vincentkang
10/05/2022, 4:37 PMbattk
10/05/2022, 4:47 PMbattk
10/05/2022, 4:49 PMlog.audit("complete", res)
and log.error("fail", err)
to more easily find your logs using the type filters of the execution logsvincentkang
10/05/2022, 4:49 PMpagedData.fetch.promise()
but also it did not work.
it does not throw an error. it does not log anythingvincentkang
10/05/2022, 4:49 PMbattk
10/05/2022, 4:51 PMvincentkang
10/05/2022, 4:53 PMvincentkang
10/05/2022, 5:16 PMlog.audit
not sure why debug does not work.battk
10/05/2022, 5:16 PMbattk
10/05/2022, 5:17 PM