Help Creating Already-Nested OmniFocus Tasks Using Shortcuts

I need help that I think only a script for OmniFocus will solve:

  1. I use 5 Root folders in OmniFocus to represent the 5 overall domains of my life.
  2. I have a Single Action List inside each of these domains
  3. Rather than have “a project per area” I use Single Action List to collect single tasks for that domain.
  4. Inside that Single Action List project, I have ALL CAPS tasks that act as topics or areas within that project. (So for example: I have a root folder called “Family”. Inside that folder I have a “Family” Single Action List. Inside the project I have 3 tasks I use as “headers” for different family members such as: “WIFE”, “DAUGHTER” and “SON”. These tasks act as parent tasks to sort the action tasks that go with each of these 3 people. Example:
WIFE
  - Subtask
 DAUGTHER
  - Subtaks
 SON
  - Subtask

I know how to use Shortcuts to get me to the Parent task, but when I add a new task, it adds it below the task and I want it to add it “inside”. So far, I have used the URL to the task to get me to the partent task, then long top and select “Add Inside” which gets me a subtask.

That’s ok, but what I really want to launch a shortcut, choose a person, and then have it automatically create a subtask under the appropriate “parent” task.

Anyone have any idea how to do this?

2 Likes

I think you could do it with an automation script right in the shortcut. In the automation, find the task with the family member’s name from your select. Then create a subtask task. Something like:

const familyMemberTask = flattenedTasks.byName(“PutYourShortcutVariableHere”);
new Task(title, familyMemberTask);

Nice, thank you! I will try it out soon. Much appreciated.

1 Like

Another idea: I also use a lot of action groups within my projects, and I want to add tasks directly to them. This seems to align with what you’re asking about here.

The ‘Add TaskPaper’ Shortcut provided by OmniFocus will accomplish this. Here’s how it works:

  1. Select ‘Task’ in the Shortcut.
  2. Enter the ‘identifier’ for the task.

For a while, I was unsure how to get the identifier. Then, I realized it’s the string that appears after omnifocus:///task/ when you use the Copy as Link command in OmniFocus.

So, grab that link (for example, for wife, daughter, son, etc.) and create a few automations using Shortcuts. You should then be able to easily add subtasks to these action groups.

1 Like

Not sure of your use case but typically say you have a task that says go for a picnic with the family, that would have more than one person. So family members to me should be a tag and the project would be picnic.

Tag is searchable using the find item search object in  shortcuts.

See if this shortcut helps you get started with adding the sub-task item

https://www.icloud.com/shortcuts/a156c6df7f3f498caacffe05a509e872