In order to modify "the status, dates, or note of a task", how about using the patch method of Tasks API?
In order to use the sample script, before you run the script, please enable Tasks API at Advanced Google Services and API console. Please confirm it at here.
Sample script:
This sample script modifies the status, dates and note of a task of taskId
in a list of tasklistId
.
var tasklistId = "###";
var taskId = "###";
var resource = {
status: "completed", // This is either "needsAction" or "completed"
due: "2019-04-15T00:00:00Z", // Due date of the task (as a RFC 3339 timestamp).
notes: "sample note",
}
var res = Tasks.Tasks.patch(resource, tasklistId, taskId);
- status: Status of the task. This is either "needsAction" or "completed".
- due: Due date of the task (as a RFC 3339 timestamp). Optional.
- notes: Notes describing the task. Optional.
Note:
- In this sample script, it supposes that you have already known
tasklistId
and taskId
.
References:
If I misunderstood your question, I apologize.
Edit:
When you want to back the completed task to "needsAction". Please use the following script.
Sample script:
var resource = {
status: "needsAction",
completed: null,
};
Tasks.Tasks.patch(resource, tasklistId, taskId);