Monday, June 10, 2019

Sample SuiteScript Code that Uses nlapiRemoveSelectOption

This below sample script shows how nlapiRemoveSelectOption works in Client Scripts Page Init function.

1. Create a User Event script under Customization > Scripting > Scripts > New > User Event to add a field SELECT before load. Deploy the script to customer record.

function addField_Script(type,form){
 //Add a tab to the Intern form.
     var firstTab = form.addTab('custpage_academichistorytab', 'Academic History');
        var select_fld = form.addField('custpage_selectfield','multiselect', 'Select');
        select_fld.addSelectOption('','');
        select_fld.addSelectOption('https://www.google.com', 'Google');
        select_fld.addSelectOption('https://www.yahoo.com', 'Yahoo');
        select_fld.addSelectOption('https://www.netsuite.com', 'NetSuite');
}

2. Create a  Client script under Customization > Scripting > Scripts > New. Use the PageInit function to remove one of the options in the Select field. Deploy the Client script to customer record.

function pageInit_RemoveSelection(){
  nlapiRemoveSelectOption('custpage_selectfield','https://www.google.com');
}


 


DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Netsuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.

Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.

Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code

 

No comments:

Post a Comment