Skip to content

Commit 63fa7cb

Browse files
authored
Merge pull request #2 from devnetkc/refactoring
♻️ Refactoring
2 parents 36b801f + 31a904f commit 63fa7cb

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
".prettierrc.json": true,
1414
"project.json": true */
1515
},
16-
"cSpell.words": ["entityid", "itemid", "quickview", "Sublist", "vendorid"],
16+
"cSpell.words": [
17+
"custbody",
18+
"entityid",
19+
"itemid",
20+
"quickview",
21+
"Sublist",
22+
"vendorid"
23+
],
1724
"editor.defaultFormatter": "esbenp.prettier-vscode",
1825
"editor.formatOnSave": true,
1926
"editor.formatOnPaste": false,

src/FileCabinet/SuiteScripts/CS/customModule_CS.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ function csExampleModule_CS(log, aModule, bModule) {
6161
log.debug({ title: `Vendor Prefix Set`, details: { VendorPrefix } });
6262
if (!scriptContext.hasOwnProperty('currentRecord'))
6363
throw 'MISSING_RECORD_PROPERTY';
64-
bModule.set_CustomFieldValue(scriptContext.currentRecord, VendorPrefix);
64+
bModule.set_CustomFieldValue({
65+
currentRecord: scriptContext.currentRecord,
66+
fieldId: 'custbody_example-id-1',
67+
value: VendorPrefix,
68+
});
6569
log.audit(`Vendor prefix saved`);
6670
} catch (err) {
6771
log.error({ title: 'csExampleModule_CS.pageInit()', details: err });
@@ -72,6 +76,7 @@ function csExampleModule_CS(log, aModule, bModule) {
7276
* @memberof module:csExampleModule_CS
7377
* @function
7478
* @param {Object} scriptContext -- Passed parameter for NetSuite CS saveRecord entry function
79+
* @param {Object} scriptContext.currentRecord -- Current record being saved
7580
* @description Entry method for CS saveRecord function
7681
* @return {boolean} - Returns `false` if record should not save yet
7782
*/
@@ -80,7 +85,7 @@ function csExampleModule_CS(log, aModule, bModule) {
8085
try {
8186
log.audit('starting custom client script saveRecord');
8287
// Run code to see if...
83-
// allowSave = false;
88+
if (!scriptContext.currentRecord) allowSave = false; //?
8489
} catch (err) {
8590
log.error({ title: 'csExampleModule_CS.saveRecord()', details: err });
8691
}

0 commit comments

Comments
 (0)