Setting the Value of the Checkbox Field in Suitelet Script

if you’re setting a checkbox to something other than T or F (NetSuite’s accepted boolean values for checkboxes), it will result in error.

Error:

You have entered an Invalid Field Value false for the following field: custpage_jj_fil_activeError at Object.onRequest.

 So, make sure you are setting it to either 'T' (for true) or 'F' (for false).

      let activeCheck  = scriptContext.request.parameters.actchec||'';
                let act = form.addField({
                    id: "custpage_jj_fil_active",
                    label: "Active Customer",
                    type: serverWidget.FieldType.CHECKBOX,
                    container: "custpage_jj_filterform"
                });
                if(activeCheck =='T'){
                    act.defaultValue = 'T';
                }
                else if(activeCheck =='F'){
                    act.defaultValue = 'F';   
                } 

Leave a comment

Your email address will not be published. Required fields are marked *