I am trying to change the parent of a new Google task created using Google Scripts. Since the parent must be changed using "move," I'm trying the following:
var oldtask = Tasks.Tasks.get(TASK_LIST_ID, TASK_ID);
var newtask = Tasks.newTask();
newtask.title = oldtask.title;
newtask.position = oldtask.position;
newtask.notes = oldtask.notes;
Tasks.Tasks.move (TASK_LIST_ID,newtask.id,oldtask.parent);
The last line throws Extra args block must be a javascript object literal. when running it from the Google Scripts editor. I have tried multiple different formats and have the feeling this is an easy fix.
This is my first post here so please let me know if you need more info.
I believe I've figured this out. A Javascript object literal is a string in the JSON style. So for example:
or used within context:
In this case, the code will display in the logger only the titles of those tasks that are incomplete, the
showCompleted: false
excluded any completed tasksReferences:
https://www.w3schools.com/js/js_objects.asp
https://www.dyn-web.com/tutorials/object-literal/
API with all the arguments
https://developers.google.com/tasks/v1/reference/tasks/list
I hope this helps