Question

Google says that setStatus property for the Tasks can be 'completed' and 'needsAction': https://developers.google.com/apps-script/class_tasks_v1_schema_task#setStatus

I'm using the API with the PHP library. When I insert a new task, I can set the status to 'completed' or 'needsAction'. But when I edit a task, if the task is already set as 'completed', I can't set the status to 'needsAction'.

So, the update works from 'needsAction' to 'completed', but not the other way. Directly on the web you can change the status however you like.

Anyone else with the same issue?

Was it helpful?

Solution

You also need to set the completedDate to null.

OTHER TIPS

Hell, it took me an hour to solve this problem. Your PHP code should look like the following for it to work:

$task = new Google_Service_Tasks_Task();
$task->setCompleted(Google_Model::NULL_VALUE);
$task->setStatus('needsAction');
$service->tasks->patch($params->tlid, $params->tid, $task);

note the special Google_Model::NULL_VALUE which is documented here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top