0
votes

I am adding the radio button on Suitlet page but it is throwing an error while loading the page. I am not sure where I am going wrong.

                        var custType1 = form.addField({
                            id: 'custpage_customertype',
                            name: 'retail_customer',
                            type: serverWidget.FieldType.RADIO,
                            label: 'Retail Customer',
                            container: 'companygroup'
                         });
                         var custType2 = form.addField({
                             id: 'custpage_customertype',
                             name: 'corporate_customer',
                             type: serverWidget.FieldType.RADIO,
                             label: 'Corporate Customer',
                             container: 'companygroup'
                         });
                         var custType3 = form.addField({
                             id: 'custpage_customertype',
                             name: 'external_customer',
                             type: serverWidget.FieldType.RADIO,
                             label: 'External Customer',
                             container: 'companygroup'
                         });    

While running the code, I am getting error on this line saying SSS_MISSING_REQD_ARGUMENT. Following is the error code -

{"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"nlobjField: Missing a required argument: radiobuttons: sSource","stack":["addField(N/serverWidget)","(/SuiteScripts/sdr_sw_suitelet_test.js:123)"],"cause":{"type":"internal error","code":"SSS_MISSING_REQD_ARGUMENT","details":"nlobjField: Missing a required argument: radiobuttons: sSource","userEvent":null,"stackTrace":["addField(N/serverWidget)","(/SuiteScripts/sdr_sw_suitelet_test.js:123)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false}

1

1 Answers

2
votes

You need a source property which will be like the id of the radio button. This will be the value used by the script to know which radio button was selected. Something like

var custType1 = form.addField({
    id: 'custpage_customertype',
    name: 'retail_customer',
    type: serverWidget.FieldType.RADIO,
    label: 'Retail Customer',
    source:'retail',
    container: 'companygroup'
 });