I have an error when I run the client script (customscript_customer_default_values.js) on the validate function. I have a client script deployed on the Customer Form. The code trigger in the address tab after you enter the address form and click okay to validate the address line (code snippet 1). I also attach the custom code by using addressValidation.js. Inside that script, it has a function called testfunction (code snippet 2). Inside that function, I use currentRecord.get() to get the address1, adress2, city, state, etc. But using that currentRecord.get() in addressValidation.js cause the error in customscript_customer_default_values.js validateLine(context) function of this line const addressSubrecord = myRecord.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');. It throws the error below, I have no idea what this error ?
{"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"missing ; before statement (/SuiteScripts/addressValidation.js#11)","stack":["wrapModuleLoaderError(handleV2RecordScripting:3409)","injectScript(handleV2RecordScripting:3531)","<anonymous>(handleV2RecordScripting:3731)","<anonymous>(handleV2RecordScripting:2630)","<anonymous>(handleV2RecordScripting:1781)","<anonymous>(handleV2RecordScripting:1771)","<anonymous>(handleV2RecordScripting:1801)","<anonymous>(handleV2RecordScripting:2104)","<anonymous>(handleV2RecordScripting:2495)","<anonymous>(handleV2RecordScripting:2089)","<anonymous>(handleV2RecordScripting:1072)","each(handleV2RecordScripting:997)","<anonymous>(handleV2RecordScripting:2051)","<anonymous>(handleV2RecordScripting:1735)","<anonymous>(handleV2RecordScripting:2400)","<anonymous>(handleV2RecordScripting:2846)","<anonymous>(handleV2RecordScripting:2847)","localRequire(handleV2RecordScripting:2389)","<anonymous>(N/scriptLoader.js)","<anonymous>(handleV2RecordScripting:2676)","<anonymous>(handleV2RecordScripting:1822)","<anonymous>(handleV2RecordScripting:2104)","<anonymous>(handleV2RecordScripting:1735)","<anonymous>(handleV2RecordScripting:2400)","<anonymous>(handleV2RecordScripting:2846)","<anonymous>(handleV2RecordScripting:2847)","localRequire(handleV2RecordScripting:2389)","entryPointRequire(N/scriptLoader.js)","v2EnhancedCall(NLRecordScripting.scriptInit:5598)","doTriggerScript(NLRecordScripting.scriptInit:5644)","nlapiPageInit(NLRecordScripting.scriptInit:390)","page_init(NLRecordScripting.scriptInit:213)"]}
customscript_customer_default_values.js code snippet 1
```javascript
function validateLine(context){
if(context.sublistId == 'addressbook'){
const myRecord = currentRecord.get();
// throw erroer
const addressSubrecord = myRecord.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');
}
return true
}
```
addressValidation.js code snippet 2
```javascript
function testfunction() {
// this is created the error above
let myRecord = currentRecord.get();
}
```