Using Suitescript 2.1 what is the correct method t...
# ask-stanley-ai
a
Using Suitescript 2.1 what is the correct method to add task assignees to a project task?
c
AI generated answer (using internal Slack threads):
In SuiteScript 2.1, you can add task assignees to a project task by using the
record
module. Here is a general example of how you can do this:
Copy code
javascript
var taskRecord = record.load({
    type: record.Type.PROJECT_TASK,
    id: 'your_project_task_id',
    isDynamic: true
});

taskRecord.selectNewLine({
    sublistId: 'assignee'
});

taskRecord.setCurrentSublistValue({
    sublistId: 'assignee',
    fieldId: 'resource',
    value: 'your_resource_id' // this is the internal id of the assignee
});

taskRecord.commitLine({
    sublistId: 'assignee'
});

var taskId = taskRecord.save();
This script loads a project task record, selects a new line in the 'assignee' sublist, sets the 'resource' field to the internal id of the assignee, commits the line, and then saves the record. Please replace
'your_project_task_id'
and
'your_resource_id'
with your actual project task id and resource id respectively. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821227908
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820495605
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81652838
Please provide your feedback on this answer.