Time-Off Management

The following record types are related to the Time-Off Management feature:

Time-Off Change

The internal ID for this record is timeoffchange.

For help working with this record in the user interface, see Viewing an Employee’s Time-Off Balance.

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:

Supported Script Types

The time-off change record is scriptable in server SuiteScript only.

Note that triggering of user events is not supported for this record.

Supported Functions

The time-off change record is not fully scriptable. Transform and copy are not permitted.

Code Samples

The following example shows how to create a time-off change.

          ...

var timeOffChange = record.create({
    type: record.Type.TIME_OFF_CHANGE
});
timeOffChange.setValue({
    fieldId: 'timeofftype',
    value: '1'                // ID of time-off type. In this example, ID of 1 is used.
});
timeOffChange.setValue({
    fieldId: 'description',
    value: 'Time-Off Type Name'
});
timeOffChange.setValue({
    fieldId: 'dateapplied',
    value: '12/25/2016'
});
timeOffChange.setValue({
    fieldId: 'amount',
    value: '1'
});
timeOffChange.setValue({
    fieldId: 'timeoffunit',
    value: '1'               // ID of unit from drop-down
});
var id = timeOffChangeReq.save();

... 

        

Time-Off Plan

The internal ID for this record is timeoffplan.

For help working with this record in the user interface, see Creating a Time-Off Plan.

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:

Supported Script Types

The time-off plan record is scriptable in server SuiteScript only.

Note that triggering of user events is not supported for this record.

Supported Functions

The time-off plan record can be read, created, updated, searched, and deleted using SuiteScript. It cannot be copied or transformed.

Code Samples

The following example shows how to create a time-off plan and modify an existing time-off plan.

          ...
//Create the Time-Off Plan record
var timeOffPlan = record.create({
    type: record.Type.TIME_OFF_PLAN
});
timeOffPlan.setValue({
    fieldId: 'name',
    value: 'new Time-Off Plan'
});
timeOffPlan.setValue({
    fieldId: 'isinactive',
    value: 'F'
});
timeOffPlan.setValue({
    fieldId: 'includefutureaccruals',
    value: 'F'
});
timeOffPlan.setValue({
    fieldId: 'subsidiary',
    value: '1'              // Use ID of subsidiary, location, department, or class. In this example, ID of 1 is used.
});
timeOffPlan.setValue({
    fieldId: 'location',
    value: '1'
});
timeOffPlan.setValue({
    fieldId: 'department',
    value: '1'
});
timeOffPlan.setValue({
    fieldId: 'class',
    value: '1'
});
timeOffPlan.setValue({
    fieldId: 'startmonth',
    value: '1'
});

var id = timeOffPlan.save();

//Modify existing Time-Off Plan record
var timeOffPlan = record.load({
    type: record.Type.TIME_OFF_PLAN,
    id: id
});
timeOffPlan.setValue({
    fieldId: 'isinactive',
    value: 'T'                // Inactivate plan
});
timeOffPlan.save();

... 

        

Time-Off Request

The internal ID for this record is timeoffrequest.

For help working with this record in the user interface, see Submitting Time-Off Requests and Approving or Rejecting Time-Off Requests.

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:

Note:

To submit time-off requests, employees must have a start date and time-off plan assigned to them on the employee record.

Supported Script Types

The time-off request record is scriptable in server SuiteScript only.

Note that triggering of user events is not supported for this record.

Supported Functions

The time-off request record is not fully scriptable. Transform and copy are not permitted.

Code Samples

The following example shows how to create and approve a time-off request.

          ...
//Create Time-Off Request
var timeOffRequest = record.create({
    type: record.Type.TIME_OFF_REQUEST
});
timeOffRequest.setValue({
    fieldId: 'employee',
    value: '25'
});
timeOffRequest.setValue({
    fieldId: 'startdate',
    value: '12/25/2016'
});
timeOffRequest.setValue({
    fieldId: 'enddate',
    value: '12/26/2016'
});
timeOffRequest.selectNewLine({
    sublistId: 'detail'
});
timeOffRequest.setCurrentSublistValue({
    sublistId: 'detail',
    fieldId: 'timeoffdate',
    value: '12/25/2016'
});
timeOffRequest.setCurrentSublistValue({
    sublistId: 'detail',
    fieldId: 'timeofftype',
    value: '1'
});
timeOffRequest.setCurrentSublistValue({
    sublistId: 'detail',
    fieldId: 'amountoftime',
    value: '1.0'
});
timeOffRequest.commitLine({
    sublistId: 'detail'
});
var id = timeOffRequest.save();

//Approve Time-Off Request
var timeOffRequest = record.load({
    type: record.Type.TIME_OFF_REQUEST,
    id: id                             // ID is the ID number of the request
});
timeOffRequest.setValue({
    fieldId: 'approvalstatus',
    value: '8'                         // Approval status is 8
});
timeOffRequest.save();
... 

        

Time-Off Rule

The internal ID for this record is timeoffrule.

For help working with this record in the user interface, see Creating a Time-Off Rule.

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:

Supported Script Types

The time-off rule record is scriptable in server SuiteScript only.

Note that triggering of user events is not supported for this record.

Supported Functions

The time-off rule record is not fully scriptable. Copy and search are not permitted.

Code Samples

The following code snippets show how to create a time-off rule.

          ...

//Create Time-Off Rule to add to exisiting Time-Off Plan record.
var timeOffRule = record.create({
    type: record.Type.TIME_OFF_RULE
});
timeOffRule.setValue({
    fieldId: 'openingbalancefornewemployees',
    value: 'T'
});
timeOffRule.setValue({
    fieldId: 'entitlement',
    value: '1'
});
timeOffRule.setValue({
    fieldId: 'maximumtenure',
    value: '1'
});
timeOffRule.setValue({
    fieldId: 'minimumtenure',
    value: '0'
});
timeOffRule.setValue({
    fieldId: 'maximumtenureunit',
    value: '1'                  // ID of unit available in drop-down. In this example, ID of 1 is used.
});
timeOffRule.setValue({
    fieldId: 'minimumtenureunit',
    value: '1'
});
timeOffRule.setValue({
    fieldId: 'entitlementunit',
    value: '1'
});
timeOffRule.setValue({
    fieldId: 'timeofftype',
    value: '1'                  // Use ID of Time-Off Type. In this example, ID of 1 is used.
} );
timeOffRule.setValue({
    fieldId: 'timeoffplan',
    value: '1'                  // Use ID of Time-Off Plan you want to assign a rule to. In this example, ID of 1 is used.
});
var id = timeOffRule.save();

... 

        

Time-Off Type

The internal ID for this record is timeofftype.

For help working with this record in the user interface, see Creating a Time-Off Type.

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:

Supported Script Types

The time-off type record is scriptable in server SuiteScript only.

Note that triggering of user events is not supported for this record.

Supported Functions

The time-off type record is not fully scriptable. Transform and copy are not permitted.

Code Samples

The following example shows how to create a time-off type.

          ...

//Create Time-Off Type
var timeOffType = record.create({
    type: record.Type.TIME_OFF_TYPE
});
timeOffType.setValue({
    fieldId: 'name',
    value: 'Time-Off Type Name'
});
timeOffType.setValue({
    fieldId: 'displayname',
    value: 'Time-Off Type Name'
});
timeOffType.setValue({
    fieldId: 'istrackonly',
    value: 'T'
});
timeOffType.setValue({
    fieldId: 'isautogeneratetimeentry',
    value: 'T'
});
timeOffType.setValue({
    fieldId: 'minimumincrement',
    value: '1'
});
timeOffType.setValue({
    fieldId: 'incrementunit',
    value: '1'                       // ID of unit available in drop-down. In this example, ID of 1 is used.
});

timeOffType.setValue({
    fieldId: 'payrollitem',
    value: '1'                      // Use ID of payroll item in the drop-down. In this example, ID of 1 is used.
});
var id = timeOffType.save();

... 

        

Related Topics

General Notices