lib_get_preferences.js
/**
* @NApiVersion 2.x
*/
define([
'N/runtime', 'N/config'
], function (runtime, config) {
/**
* Load the COMPANY_PREFERENCES record and return fields from it. The fields are returned as an object.
* @return {function} This function returns a function. You must call
* the returned function to get the account preferences object.
*/
function getPreferences () {
// Returning an inner function here to outfox NetSuite's SuiteScript validation
return function _getPreferences() {
const configRec = config.load({
type: config.Type.COMPANY_PREFERENCES
});
const PREFERENCES = {
BLACK_FOREST_STORE_ID: configRec.getValue('custscript_black_forest_store_id'),
BLACK_FOREST_STORE_AUTH_TOKEN: configRec.getValue('custscript_black_forest_store_auth_token'),
MINIMUM_COST_FOR_FREE_SHIPPING: configRec.getValue('custscript_min_amt_free_ship'),
SPECIAL_ORDER_FEE: configRec.getValue('custscript_ord_hand_fee')
}
return PREFERENCES
}
}
return {
getPreferences: getPreferences
};
});