-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalized SS 2.0 feature dump implementation
- Loading branch information
1 parent
dd1362e
commit df1fc39
Showing
1 changed file
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,52 @@ | ||
require(['N/config'], | ||
function(config) { | ||
function getFeatures() { | ||
var featureInfo = config.load({ | ||
type: config.Type.FEATURES | ||
}); | ||
|
||
var features = {}; | ||
var featureList = featureInfo.getFields() | ||
|
||
for(var k in featureList) { | ||
features[featureList[k]] = featureInfo.getValue(featureList[k]); | ||
} | ||
|
||
JSON.stringify(features) | ||
/** | ||
* @NApiVersion 2.x | ||
* @NScriptType restlet | ||
*/ | ||
|
||
/* | ||
## Upload Script | ||
https://system.sandbox.netsuite.com/app/common/scripting/uploadScriptFile.nl | ||
File Name: netsuite_features.js | ||
## Create RESETLEt | ||
Name: Feature Inspection | ||
ID: _feature_inspection | ||
Description: Dump features as JSON. Do not install in production. | ||
Deployments > Title: Feature Inspection | ||
Deployments > Status: Released | ||
*/ | ||
|
||
define(['N/config'], function(config) { | ||
return { | ||
get: function() { | ||
var allConfigTypes = [ | ||
config.Type.FEATURES, | ||
config.Type.COMPANY_INFORMATION, | ||
config.Type.COMPANY_PREFERENCES, | ||
config.Type.ACCOUNTING_PREFERENCES | ||
]; | ||
|
||
var features = {}; | ||
|
||
for(var typeIndex in allConfigTypes) { | ||
var type = allConfigTypes[typeIndex]; | ||
|
||
var featureInfo = config.load({ | ||
type: type | ||
}); | ||
|
||
features[type] = {}; | ||
|
||
var featureList = featureInfo.getFields() | ||
|
||
for(var k in featureList) { | ||
features[type][featureList[k]] = featureInfo.getValue(featureList[k]); | ||
} | ||
} | ||
|
||
return getFeatures(); | ||
return features; | ||
} | ||
} | ||
}); | ||
|
||
|
||
'debug'; |