I hope Asana supports the “not” operator for conditions in rules.
In the early stage, not all conditions are available for scenarios.
If we have the “not” operator, we can cover a wider range of situations for automation.
For example, I want to change a task status to “undone” when the task status changes to “complete” if all subtasks are not done.
Currently, we only have a condition for “all subtasks are done”. So we cannot create the right condition for that.
Yesterday they released an “otherwise” branch in Rules, did you see?
that’s basically what you need, make a branch with the right condition that does nothing (like multi-home in a dummy project of whatever) and then an Otherwise branch.
Unfortunately, it didn’t work well when a task has no subtask. The task status changed to “incomplete”. In this case, I need another condition for “at least one subtask is incomplete” or “task has no subtask” to achieve what I want.
Finally, I assume the following:
Even if I use the “not” operator, the rule doesn’t work well when “All subtasks are marked as *” doesn’t represent “A task has subtask/subtasks and All subtasks are marked as *”. So, my post might not be a good proposal.
Does someone have a solution for this specific case?
@lpb
Thanks for your comment.
For subtask(s), custom field2 is dummy.
In this case, only custom field2 for parent task(s) is important because rule3 runs on tasks (parent tasks). And the rollup function sets the state of subtask(s) for parent tasks automatically.
In good point of rollup(), it calculates just a value of subtask(s).
When I read the document of it, I strongly felt weird.
‘Why ? it doesn’t calculate values including parent task!’
It would have solved: Check if: not(All subtasks are marked as Complete)
Now I need to choose between All subtasks are marked as Complete and All subtasks are marked as Incomplete.
There may be a workaround possible but it is far from intuitive.
Being able to wrap a condition (or a set of conditions) to an inverse would solve this and many other use cases where the specific variations of the condition options don’t include the exact option I am looking for.
I did a bit of searching but I wasn’t able to find a topic about this particular workflow nuance.
In my project rules move task from section to section adding new subtasks to the task in each section.
There is the ability to check if all subtasks are complete. And I can check is all subtasks are incomplete.
I have to rule to mark the task incomplete and comment a reminder to the user to complete all subtasks before completing the parent task. This works great is all the subtasks are incomplete but does nothing is some subtasks are incomplete.
The other rule to move the task to the next section also hangs because the condition of all subtasks being complete is not met.
I’m unable to use any third party extensions so has anyone found a native workaround? Or am I just being dense and missing something obvious?
@Jan-Rienk
thanks for your comment.
It works well when a task has subtask(s).But It doesn’t work well when a task doesn’t have subtask(s).
P.S.
Now a day, we can also use script action to solve this if we have enterprise/+.
A code is the following.(I used AI for coding.)
/**
* What's in scope?
* 1. (string) project_gid, workspace_gid, task_gid (only if triggered on a task)
* 2. (function) log - this behaves like console.log and takes any number of parameters
* 3. (object) *ApiInstance - for each group of APIs, an object containing functions to call the APIs; for example:
* tasksApiInstance.getTask(...)
* goalsApiInstance.addFollowers(...)
* For more info, see https://github.com/Asana/node-asana
*/
async function run() {
// サブタスクを取得
const subtasks = await tasksApiInstance.getSubtasksForTask(task_gid);
// サブタスクの完了状態を確認
let allSubtasksCompleted = true;
for (const subtask of subtasks.data) {
// サブタスクの詳細情報を取得
const subtaskDetails = await tasksApiInstance.getTask(subtask.gid);
// 未完了のサブタスクがあるかチェック
log(subtaskDetails.data.completed)
if (!subtaskDetails.data.completed) {
allSubtasksCompleted = false;
break;
}
}
// 未完了のサブタスクがある場合、親タスクを未完了に設定
if (!allSubtasksCompleted) {
let body = {
"data":{
"completed": false
}
}
await tasksApiInstance.updateTask(body, task_gid);
}
}
// To function properly, the script must end with returning a Promise via run().
run();
In that case a not operator or function alone wouldn’t solve the challenge. To solve this without scripting it would also require a “has subtasks” condition. For which it would probably also be handy to invert with a not(has_subtasks).