Search code examples
netsuitesuitescript

I want to add custom option in NetSuite


Now, I'm in a course of learning NetSuite. My task is to add custom option in Sales Order Record. I tried this using UserEvent script but it doesn't work.

if(context.form && context.type == context.UserEventType.EDIT) {
    var currentForm = context.form;
        
    currentForm.addField({
        id: 'custpage_paymentoption',
        type: 'SELECT',
        label: 'Custom Payment Option',
        container : 'paymentmethod'
    });
    currentForm.addSelectOption({
        value: 'card1',
        text:  'Card1',
    });
    currentForm.addSelectOption({
        value: 'card2',
        text:  'Card2',
    });
    currentForm.addSelectOption({
        value: 'card2',
        text:  'Card2',
    });
}

I'm not sure this is script issue.


Solution

    1. Remove container value in addField().
    2. Use insertSelectOption() instead of addSelectOption().

    Hope this advice is helpful for you.