Payroll Item

Payroll items store values for payroll transaction line items. Payroll items are used with payroll transactions generated by the Payroll feature, but these transactions are managed by NetSuite and are generally not used in integrations.

For help working with this record in the UI, see Paycheck Journal Feature.

The internal ID for this record is payrollitem.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with this record in SuiteScript, see the following help topics:

Supported Script Types

The payroll item record is scriptable in both client and server SuiteScript.

Supported Functions

The payroll item record is fully scriptable, which means that it can be created, updated, copied, deleted, and searched using SuiteScript.

Usage Notes

The exposure of this record to SuiteScript is intended to enable global payroll solutions. You can use it along with the Paycheck Journal record to create custom payroll solutions and to support integrations with external payroll systems. For details, see Paycheck Journal Feature.

Code Samples

The following samples create Deduction type payroll items.

          function createPayrollItemdeductionMinimal(){
    var payrollItem = record.create({
        type: record.Type.PAYROLL_ITEM
    });
    payrollItem.setValue({
        fieldId: 'subsidiary',
        value: 1
    });
    payrollItem.setValue({
        fieldId: 'itemtype',
        value: 16
    });
    payrollItem.setValue({
        fieldId: 'liabilityaccount',
        value: 27
    });
    payrollItem.setValue({
        fieldId: 'name',
        value: 'SSSitem-Deduction-Minimal'
    });
    payrollItem.setValue({
        fieldId: 'custrecord_payroll_item',
        value: 'Cust_field'
    });
    payrollItem.setValue({
        fieldId: 'externalid',
        value: 'testingexternalID'
    });
    var recId = payrollItem.save();   
} 

        
          function createPayrollItemdeductionComplete(){
    var payrollItem = record.create({
        type: record.Type.PAYROLL_ITEM
    });
    payrollItem.setValue({
        fieldId: 'externalid',
        value: 'SSSitem-Deduction-Completed'
    });
    payrollItem.setValue({
        fieldId: 'subsidiary',
        value: 1
    });
    payrollItem.setValue({
        fieldId: 'itemtype',
        value: 16
    });
    payrollItem.setValue({
        fieldId: 'liabilityaccount',
        value: 22
    });
    payrollItem.setValue({
        fieldId: 'name',
        value: 'SSSitem-Deduction'
    });
    payrollItem.setValue({
        fieldId: 'vendor',
        value: 1
    });
    payrollItem.setValue({
        fieldId: 'employeepaid',
        value: true
    });   
    payrollItem.setValue({
        fieldId: 'custrecord_payroll_item',
        value: 'Cust_field'
    });
    var recId = payrollItem.save();
} 

        

The following samples create Earning:Addition type payroll items.

          function createPayrollItemAdditionMinimal(){
    var payrollItem = record.create({
        type: record.Type.PAYROLL_ITEM
    });
    payrollItem.setValue({
        fieldId: 'subsidiary',
        value: 1
    });
    payrollItem.setValue({
        fieldId: 'itemtype',
        value: 6
    });
    payrollItem.setValue({
        fieldId: 'expenseaccount',
        value: 114
    });
    payrollItem.setValue({
        fieldId: 'name',
        value: 'SSSitem-addition-Minimal'
    });
    payrollItem.setValue({
        fieldId: 'custrecord_payroll_item',
        value: 'Cust_field'
    });
    var recId = payrollItem.save();
} 

        
          function createPayrollItemAdditionComplete() {
    var payrollItem = record.create({
        type: record.Type.PAYROLL_ITEM
    });
    payrollItem.setValue({
        fieldId: 'externalid',
        value: 'SSSitem-Addition-Completed'
    });
    payrollItem.setValue({
        fieldId: 'subsidiary',
        value: 1
    });
    payrollItem.setValue({
        fieldId: 'itemtype',
        value: 6
    });
    payrollItem.setValue({
        fieldId: 'expenseaccount',
        value: 114
    });
    payrollItem.setValue({
        fieldId: 'name',
        value: 'SSSitem-Addition'
    });
    payrollItem.setValue({
        fieldId: 'custrecord_payroll_item',
        value: 'Cust_field'
    });
    var recId = payrollItem.save();
} 

        

The following sample shows how to update a payroll item.

          function updatePayrollItem(){
    var payrollItem = record.create({
        type: record.Type.PAYROLL_ITEM,
        defaultValues: 110
    });
    payrollItem.setValue({
        fieldId: 'liabilityaccount',
        value: 29
    });
    payrollItem.setValue({
        fieldId: 'vendor',
        value: 6
    });
    payrollItem.setValue({
        fieldId: 'custrecord_payroll_item',
        value: 'Updated'
    });
    payrollItem.setValue({
        fieldId: 'inactive',
        value: true
    });
    var recID = payrollItem.save();
} 

        

The following sample shows how to delete a payroll item.

          function deletePayrollItem(){
    var savedSearchInternalId = 2;
    var searchresults = search.load({
        type: search.Type.PAYROLL_ITEM,
        id: savedSearchInternalId
    });
    for (var i = 0; searchresults != null && i < searchresults.length; i++ ){
        var searchresult = searchresults[i];
        if (0 < searchresults[i].getId()){
            record.delete({
                type: searchresults[i].getRecordType(),
                id: searchresults[i].getId()
            });
        }
    }
} 

        

Related Topics

General Notices