However, if I include that module, I cannot save t...
# suitescript
j
However, if I include that module, I cannot save the file. I get
Fail to evaluate script: {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"","stack":[]}
b
do a support case
j
Thanks, but I was just curious if anyone had come across this issue before. Often it is faster to check with people here than to file a case.
s
It works in 2.0 but not 2.1?
j
It works in 2.x at least.
s
I've never encountered an issue of a script working in 2.0 and not 2.1. Typically it's the opposite.
Are you using an amdconfig file and custom modules?
j
I stripped this down just to test.
I can save this:
Copy code
/**
 * cf_worksheet_ss2.js
 * 
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * 
 * Custom Form Script for Worksheets
 * 
 * Currently in use for the UAV (testing) and HVR (testing) Worksheets
 * 
 * Last modified 2021-03-03 JB
 */
define(['N/query'], 
	function(query) {
						
	function fieldChanged(context) {}
    
    
    return {
        fieldChanged: fieldChanged
    };
});
but I cannot save this:
Copy code
/**
 * cf_worksheet_ss2.js
 * 
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * 
 * Custom Form Script for Worksheets
 * 
 * Currently in use for the UAV (testing) and HVR (testing) Worksheets
 * 
 * Last modified 2021-03-03 JB
 */
define(['N/record'], 
	function(record) {
						
	function fieldChanged(context) {}
    
    
    return {
        fieldChanged: fieldChanged
    };
});
(same except one is including the
N/record
module
s
I've never seen this before. Given the examples that you have shared, there should not be any issue. Submitting a support ticket is going to be your best bet.
j
Have done so. Was just wondering if I was missing something obvious!
s
Nope! Good luck!
j
Thanks!
r
Just curious why
N/record
and not
N/currentRecord
?
j
cuz I’m having to do record.load / record.create etc
m
Defect 624685 :  SuiteScript 2.1 > Client Script > Unable to upload file if record, https or search module is used in define function
The urgency level assigned to your defect is U3. U3 issues are treated as priority work by NetSuite Product teams during business hours.
Same issue occurs with N/currentRecord
Temporary workaround I'm using is a local require
Copy code
exports.selectRebateAccrual = async () => {
    // There seems to be a NetSuite bug including N/currentRecord as a dependency to the script, leading to following error
    // when attempting to upload the file:
    // - There was a problem when uploading the file. Details: Fail to evaluate script: {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"","stack":[]}.
    // As a workaround, use local require
    const requirePromise = (module) => new Promise((resolve) => require([module], resolve));
    const currentRecord = await requirePromise("N/currentRecord");

    // use currentRecord module here...
}
🤔 1
j
I’m attached to the defect now. At least it looks like it’s a high priority.
t
Hello @michoel, where can I see all defects. Like you have given this id , where can I go and check this ?
m
There is no publically available list of defects.
j
it would probably break the internet due to being too big
🤣 1
m
Update from support
This is the update about Defect 624685. Target has been set, which on another e-Fix schedule. Please refer to e-Fix Release Notification (Answer Id: 34424). This is not yet final and it is subject to change. We will keep you posted for any updates.