Adding Non-Billable Items through SuiteScript when Items Billable by Default Accounting Preference is Enabled

Adding non-billable items through SuiteScript with the Items Billable by Default Accounting Preference is enabled in Setup > Accounting > Accounting Preferences under Time & Expenses tab.

When the Purchase Order is created through SuiteScript with non-billable item/s it is billable by default. Even when the billable field is changed to false through NetSuite User Interface, upon saving the record, it is automatically set back to true.

To deal with this behavior, these are the possible solutions:

The Items Billable by Default preference can be disabled

In some cases when the preference needs to be enabled, it is required to also set the billable field to false when adding non-billable items through SuiteScript 

Here’s a sample code when adding non-billable items in a Purchase Order through SuiteScript:

/**
 * @NApiVersion 2.x
 */


require(['N/currentRecord'], function(currentRecord){
    var rec = currentRecord.get();
    rec.selectNewLine({
        sublistId: 'item'
    });
    rec.setCurrentSublistValue({
        sublistId: 'item',
        fieldId: 'item',
        value: 39,
        forceSyncSourcing:true
    });
    rec.setCurrentSublistValue({
        sublistId: 'item',
        fieldId: 'quantity',
        value: 1,
        forceSyncSourcing:true
    });
    rec.setCurrentSublistValue({
        sublistId: 'item',
        fieldId: 'isbillable',
        value: false,
        forceSyncSourcing:true
    });
    rec.commitLine({sublistId: 'item'});
})

Leave a comment

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