How to Un-assign a Task from a Project (in javascript plugin)?

By " Un-assign a Task from a Project", I meant set a task’s project to nothing.
You can also think it as removing a task from a project.

I need to do it in a plugin (js), I tried this method:

moveTasks([task], null)

but this method doesn’t accept null as 2nd parameter.

This seems such a basic thing to do but I couldn’t figure it out, I must be overlooking something very simple.

Thanks in advance!

You should move it to the Inbox. Tasks are always contained in a project, which Inbox is a special instance of.

As the second parameter try inbox.ending which returns a location for the task.

1 Like

@MultiDim Dude, you are a genius!

moveTasks([task], inbox.ending) works like a charm!

I had tried moveTasks([task], inbox) but inbox (subclass of TaskArray) isn’t accepted by the method. Never noticed that inbox.ending (type of Task.ChildInsertionLocation) is accepted.

Anyway, thanks a lot!

1 Like

One more thing…

There’s a Voice Control command for this as part of the Omni Voice Control Collection

1 Like

@Sal Nice thanks for sharing!

I don’t know why I didn’t find it.

Looked at the script, it’s using the same method 👍

moveTasks([tasks[0]], inbox.ending)

Move to Inbox
Over 100 Voice Commands and Over 50 Videos

1 Like