Subtasks of tasks with no project are hard to be batch retrieved

Users have spawned tasks that can’t be fetched by “find by project” API call

Here’s what the problem looks like:
There are tasks that have parent GID which links to a task that had no project linked to it and thus wasn’t fetched with the rest using findByProject method.

Here’s how it looks at the user-level. There are three levels of tasks:

  • high level (linked to a project);
  • the middle level, subtasks of high-level tasks (not linked to a project);
  • low-level, subtasks of the middle-level tasks (linked to a project)

I don’t know how users have done it, but I could try finding them in our organization to ask them.

My question is:

Could this problem have been avoided by making a project field mandatory for tasks or setting a default one?

Hi @anon97007178,

Yes, what you’ve described here is a function of the design of Asana. The designations of “middle level” and “low level” aren’t correct, though; any subtask in Asana, at any sub-level, can be attached to one or more projects or can not be attached to any projects. (Let me know if that’s unclear.)

There’s no way to do either of those things in Asana, I’m afraid - it doesn’t support setting mandatory fields on a task or setting default values. (In some circumstances one can accomplish those things by using rules, but rules won’t work for your scenario of wanting to set mandatory or default fields for subtasks.)

1 Like

When you start handling all possibilities of subtasks, get ready for more problems…

Subtasks can have no project (default), or “any” project. Not just the one from its parent.

Task1 → Project 1
Subtasks:
Task1.1 (no project)
Task1.2 (project1)
Task1.3 (Project2) ← !!!

If you want to make subtasks easier to query, I suggest to use the the “Advanced Search API”, if you have access to it, and filter subtasks.

GET /workspaces/xxx/tasks/search?is_subtasks=true (+ any other filter)

And, if you want only subtasks without projects:
GET /workspaces/xxx/tasks/search?is_subtasks=true&projects.any=null

You can have 5 levels of subtasks, each with 0, 1 or or multiple different projects on each level of subtasks!

Also, very funny…
You can open task 1.3, and go to “advanced options” and choose “make a subtask of”, and you choose any task, of any project, as the new parent of that subtask.

The subtask is now linked to the new task, but NOT the previous one,.
I think and hope I am right on it, 1 subtask can only have 1 parent.
So 1 subtask can’t be child of 2 different tasks…

Imagine if you have Subtask1 of Task1 in Project1, and you add subtask1 to project1. Now, use the “make subtask of” option, and choose Task 3 in Project 3!

Subtask1 in project1 is now owned by Task3 in project3. Is the subtask1 member of project1 from its membership property, or project3 from its “parent.project” property? And if the parent is member of multiple projects? It’s up to you!

Then, repeat it on 5 levels of subtask!

Subtasks can quickly become a real pain because a lot of possibilities are allowed.

1 Like

Well put, @Frederic_Malenfant. :woozy_face:

Correct!

1 Like

Thank you for clarifying.
Turns out, my problem runs much deeper:
I intended to load all tasks from Asana but I found only one way to do that without premium account with its findByWorkspace API method. I have originally used findByProject after querying projects, but that appears to be a wrong way to extract tasks.