Project Task

The project task record can be used to keep track of specific activities and milestones associated with a project.

The internal ID for this record is projecttask.

The project task record is available when the Project Management feature is enabled at Setup > Company > Enable Features, on the Company subtab. When the feature is enabled, you can access the project task record in the UI by going to an existing project and clicking the New Project Task or New Milestone button.

For help working with this record in the user interface, see Project Tasks.

Project task records cannot be created as standalone records. Rather, you create a project task for a specific project record, and the task remains attached to that record. For information about working with the project record in SuiteScript, see Project.

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:

Project Tasks Versus Milestone Tasks

Every project task record is designated as either a project task or a milestone task. A project task is used to represent an activity, whereas a milestone task is used to represent a checkpoint in the overall progress of the project.

Although they are the same type of record, a milestone task cannot have values in the estimatedwork body or sublist fields. Therefore, if you create a project task record and do not include any estimated work, the record is automatically saved as a milestone task. If you do include estimated work, the record is saved as a project task.

These same rules apply to the updating of records as well. In other words:

Note that the estimatedwork body field is populated by the sum of estimated work listed for Assignees. If you explicitly set a value for the estimatedwork body field, and you also include Assignees, the value you specify for the body field is overwritten based on the sublist’s estimatedwork values. If you do not include Assignees, you can explicitly assign a value to the estimatedwork body field.

Supported Script Types

The project record is scriptable in server SuiteScript only.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The project record is fully scriptable — it can be created, updated, copied, deleted, and searched using SuiteScript.

Field Definitions

When creating new project tasks you must set the Project (company) field to the project/job ID. Project tasks are not standalone records, and therefore must be associated with a specific project.

For other details on body fields and sublist fields, See the SuiteScript Records Browser, which lists all internal IDs associated with this record. For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

Code Sample

The following example shows how you might create both a project task and a milestone task.

          // create a project
var project = record.create({
    type: record.Type.JOB,
    isDynamic: true
});
project.setValue({
    fieldId: 'companyname',
    value: 'Reconstruction'
});
project.setValue({
    fieldId: 'subsidiary',
    value: 1
});
var projectId = project.save();

// create a project task
var task = record.create({
    type: record.Type.PROJECT_TASK
});
task.setValue({
    fieldId: 'estimatedwork',
    value: 2
});
task.setValue({
    sublistId: 'title',
    value: 'Remove old furniture'
});
task.setValue({
    sublistId: 'company',
    value: projectId
});
var task1Id = task.save();

// create another task depending on the first one with Finish-To-Start dependency
task = record.create({
    type: record.Type.PROJECT_TASK
});
task.setValue({
    fieldId: 'estimatedwork',
    value: 5
});
task.setValue({
    fieldId: 'title',
    value: 'Paint walls'
});
task.setValue({
    fieldId: 'company',
    value: projectId
});
task.selectNewLine({
    sublistId: 'predecessor'
});
task.setCurrentSublistValue({
    sublistId: 'predecessor',
    fieldId: 'task',
    value: task1Id
});
task.setCurrentSublistValue({
    sublistId: 'predecessor',
    fieldId: 'type',
    value: 'FS'
});
task.commitLine({
    sublistId: 'predecessor'
});
var task2Id = task.save();

// create a milestone
task = record.create({
    type: record.Type.PROJECT_TASK,
    isDynamic: true
});
task.setValue({
    fieldId: 'estimatedwork',
    value: 0
});
task.setValue({
    fieldId: 'title',
    value: 'Verify painting after the walls dry out'
});
task.setValue({
    sublistId: 'company',
    value: projectId
});
task.selectNewLine({
    sublistId: 'predecessor'
});
task.setCurrentSublistValue({
    sublistId: 'predecessor',
    fieldId: 'task',
    value: task2Id
});
task.setCurrentSublistValue({
    sublistId: 'predecessor',
    fieldId: 'type',
    value: 'FS'
});
task.commitLine({
    sublistId: 'predecessor'
});
var milestoneId = task.save(); 

        

Related Topics

General Notices