OmniFocus Templates with (or without) Relative Dates
Store templates inside OmniFocus, replacing variables and adjusting relative dates
This shortcut allows you to generate new projects or action groups within OmniFocus from templates you set up within OmniFocus. You do not need to get involved with TaskPaper, and get to keep your templates inside OmniFocus where you are free to revise them at will without babysitting TaskPaper templates in some other app. Personally, I keep all my templates in a top-level projects folder called “Templates,” but because the trigger for this shortcut is using the share sheet from a template, you can keep them wherever you’d like in your OmniFocus project hierarchy. (It doesn’t even matter whether you prefer your templates to be projects or action groups.)
There are two conventions your templates should adhere to: 1. Any variables you would like the shortcut to offer to replace should be formatted as <<VARIABLE>>. These can be in any text fields: task names, tags, notes, etc. Anywhere <<VARIABLE>> if found, the shortcut will replace it with what you specify when asked. (If nothing formatted this way is found in the template, the shortcut will not prompt you.) 2. If your template contains defer or due dates, the shortcut will prompt you for a predicate date*. If you do not wish to process these dates, merely select “Okay” and the default answer provided will ensure your dates are left alone. (If no defer or due dates are found, the shortcut will not prompt you.)
*Predicate dates are where things get fun. This is a date which is ‘ground zero’ for the template. All the dates in the template will be processed to center on this date while preserving their relative distance to one another. For example, one could set up a template with a set of tasks with a variety of defer and due dates having to do with the first visit with a client. One task might be deferred until that appointment date, another might be due a week later, and one might need to be done three days prior! Predicate dates allow you to plug in this ‘ground zero’ date and the shortcut will process all dates to center there.
Here’s how it works: You set up your templates as if the ground zero date is 01/01/2045 12:00 AM. (This date was used simply because picking a date much further out caused Shortcuts not to recognize it as a date.) I like to label my templates as something like “New Client (Predicate date: first session).”
So, for a task I want to be due by the client’s first session, in the template that task should be due 01/01/2045 at 12:00 AM. If there is a task I’d like to defer until a week after the first session, in the template it would be 01/08/2045 at 12:00 AM. And so on. When the shortcut prompts you for a predicate date, it first gets the time between that date and 01/01/2045 at 12:00 AM. It then applies that difference to all dates within the template, moving all of them by the same amount so that they are predicated on the date specified while remaining identically spaced in relation to each other. What was three days apart in the template remains three days apart in the output. (I even have a few templates whose predicate date is the current date and time.)
To trigger the shortcut, navigate to your template inside OmniFocus, whether it is a project or an action group. Use the share sheet to send it to this shortcut. As previously described, it will prompt you for a variable name and/or predicate date if these are relevant (if it detects any <<VARIABLES>> or dates).
The shortcut offers to output the processed template to your OmniFocus Inbox (as an action group), an existing Project (as an action group), a project Folder (as a project), or the top-level projects folder (as a project). Your original template remains where it was, unaffected and ready to be called upon whenever it is needed again.
Latest Release Notes
1.11 - Sept. 15, 2021, 1:36 p.m.
Added an action to the beginning of the shortcut to continue in the Shortcuts app, in order to avoid an issue in iOS 15 where it asks you for all the variables twice.