Sunday, 16 June 2019

How do you create Radio buttons in NetSuite ?

As per my knowledge we cannot create a radio field using Suite Customization, like Creating Custom Field, Creating a radio button using workflow is not available.

To Overcome that we can use SuiteScript.  We can create the RADIO button field using the "N/ui/ServerWidget" Module.

Follow below steps to create a radio button in NS:

1. Load the "N/ui/ServerWidget" in server side script, like UserEvet or Suitelet depends upon the requirement,

2. Use "form.addField(options)" to add a field,

Below are the options , which needs to be used:


// Create Radio button for undeposited
        var field2 = context.form.addField({
        id: 'custpage_radiofield',
        type: serverWidget.FieldType.RADIO,
        label: 'Undep.Funds',
        source: 'undepfunds'
        });

/ Create Radio button To select Account
        var field3 = context.form.addField({
        id: 'custpage_radiofield',
        type: serverWidget.FieldType.RADIO,
        label: 'Account',
        source: 'selectaccount'
        });

Use field.setHelpText(options) to set the help text in the fields.

field2.setHelpText({
       
        help : "Select Undeposited Account",
        showInlineForAssistbaonotlean: true
       
        });

 In Radio buttons, the 'id' will be always same, we must have source as unique, we must use source to select the radio buttons.

like  below:

 if (record.getValue('custpage_radiofield') == 'undepfunds' ) {

<< Do something>>

 }

 if (record.getValue('custpage_radiofield') == 'selectaccount' ) {

<< Do something>>

 }

Please go through suitescript 2.0 API document if you need more information.

Thanks


2 comments:

  1. Hi,
    I'm creating a customer record in suitelet. How do I set the type of the customer to an individual?

    ReplyDelete