This topic contains 6 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 10 months ago.
-
AuthorPosts
-
January 9, 2017 at 6:04 pm #1332
darrenhillconsultingSo,
I’ve long disliked how Netsuite handles Global Parameters. I should be able to implement a global variable ‘outside’ of a scripte record (since, its not actually tie to a single script). But I digress.
So, in SS 2.0, how do I retrieve that COMPANY level preference value?
With
runtime.getCurrentScript().getParameter Or runtime.getCurrentUser().getPreference
This is a cached copy. Click here to see the original post. -
January 9, 2017 at 6:33 pm #1333
michoelSS1.0
Code:
var value = nlapiGetContext().getSetting(‘SCRIPT’, ‘custscript_parameter’);
SS2.0Code:
var value = runtime.getCurrentScript().getParameter({name: ‘custscript_parameter’}) -
January 9, 2017 at 9:16 pm #1334
chanarbonIf the information that you want to retrieve can be found on the company information, you can use config module to load the information using var compInfo = config.load({type: config.type.COMPANY_INFORMATION}) and a conpInfo.getValue(‘custscript_paramaters’)
-
January 9, 2017 at 10:07 pm #1335
michoelOriginally posted by chanarbon
View Post
If the information that you want to retrieve can be found on the company information, you can use config module to load the information using var compInfo = config.load({type: config.type.COMPANY_INFORMATION}) and a conpInfo.getValue(‘custscript_paramaters’)
I think that should be config.Type.COMPANY_PRโEโFโEโRโEโNโCโEโS, not COMPANY_INFORMATION.
-
January 9, 2017 at 10:13 pm #1336
michoelAlso the code samples in the documentation for the N/config module are incorrect. The options object for setValue / getValue should have a fieldId parameter, not name.
I would submit a Defect to support, but I don’t have the patience at the moment
https://system.netsuite.com/app/help…261803800.html
Code:
/**
*@NApiVersion 2.x
*/
require([‘N/config’],
function(config) {
function setTaxAndEmployerId() {
var companyInfo = config.load({
type: config.Type.COMPANY_INFORMATION
});
companyInfo.setValue({
name: ‘taxid’,
value: ‘1122334455’
});
companyInfo.setValue({
name: ’employerid’,
value: ‘123456789’
});
companyInfo.save();
companyInfo = config.load({
type: config.Type.COMPANY_INFORMATION
});
var taxid = companyInfo.getValue({
name: ‘taxid’
});
}
setTaxAndEmployerId();
}); -
January 10, 2017 at 12:07 am #1337
chanarbonOriginally posted by michoel
View Post
I think that should be config.Type.COMPANY_PRโEโFโEโRโEโNโCโEโS, not COMPANY_INFORMATION.
Yup. That’s where to check for the preferences the information should be extracted from COMPANY_PRโEโFโEโRโEโNโCโEโS while other company-wide details are on COMPANY_INโFโOโRโMโAโTโIโOโN
-
January 10, 2017 at 8:07 am #1338
darrenhillconsultingThanks all … this is great info.
By the details above … it looks like I could SET a custom Company Pref?!?!? Wow. That would be an HUGE upgrade from SS1.0.
I’ll keep you all posted
-
AuthorPosts
You must be logged in to reply to this topic.