Looking for a script that does the following:


Does anyone have a script that automatically adds a set tag when a task is flagged and ALSO removes that same tag if a task is un-flagged?

Here is something that might work for you (you’ll need to save it as a .omnijs plug-in file):

var flaggedTag = tagNamed("Urgent") //Replace 'Urgent' with the name of the tag you want to use

flattenedTasks.forEach(task => {
	if (task.flagged && !task.completed){
	} else if (!task.flagged && !task.completed && task.tags.includes(flaggedTag)){

Be aware that this only acts on tasks that are uncompleted and that are directly flagged—meaning if a task is just inside of a flagged project and inheriting the flagged status of the project, it is ignored. If you want to change that replace all instances of task.flagged with task.effectivelyFlagged.

If you need help turning that into a plug-in you can install or if you’d like learn how to edit that to do things a bit differently, check out these links:


Thank you so much!