This topic contains 6 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 10 months ago.

  • Author
    Posts
  • #1332

    darrenhillconsulting

    So,

    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.

  • #1333

    michoel

    SS1.0

    Code:
    var value = nlapiGetContext().getSetting(‘SCRIPT’, ‘custscript_parameter’);
    SS2.0

    Code:
    var value = runtime.getCurrentScript().getParameter({name: ‘custscript_parameter’})

  • #1334

    chanarbon

    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’)

  • #1335

    michoel

    Originally 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.

  • #1336

    michoel

    Also 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();
    });

  • #1337

    chanarbon

    Originally 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

  • #1338

    darrenhillconsulting

    Thanks 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

You must be logged in to reply to this topic.