Hey good morning, I am using postSourcing to set a...
# suitescript
k
Hey good morning, I am using postSourcing to set a field value and I cannot select any other field value. I added return true at the end of the function but I am still getting the error [10:53 AM] function postSourcing(scriptContext) { var crecord = scriptContext.currentRecord; crecord.setValue({ fieldId: "custbody_bb_next_approver_wo", value: 67271 }) crecord.setValue({ fieldId: "custbody_bbg_wo_approval_status", value: 4 }) return true; }
e
Almost certainly an infinite loop. Calling
setValue
from inside
fieldChanged
or
postSourcing
will then additionally trigger
fieldChanged
and
postSourcing
infinitely.
You will want to add guards so that you only call
setValue
when specific fields change, and you can also leverage the
ignoreFieldChange
parameter of `setValue`: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4273155868.html#Record.setValue(options)
k
I have added ignoreFieldChange: true and I am still getting the issue where I cannot select values for any other fields
y
You must check the field id here .
r
Untitled.js
e
No need for a return value in
postSourcing
1