Apply action to all drafts with same tag?

Is it possible to create an action that will iterate through each draft with the same tag? For instance, if I had items tagged “bear” or “dayone” to go through each one and move them, one by one, into those apps? If not within drafts itself, could it be done from the shortcuts app?

Yes, it is possible to query and loop over drafts in an action.

For your case you may just be looking for batch operations. Filter draft list by a tag, tap and hold “Select” to select all, then use Operations > Run Action.

1 Like

It looks like Greg’s given a definitive reply while I’ve been composing a response and helping my son with his homework; but just in case it helps, and given I’d mostly written it already, I thought I’d post what I’d got anyway.


You could do it wih an action, but you can do it with the built-in batch operation functionality.

Choose to filter on the tag you want:

Then choose to select (press and hold to select all) whichever drafts you want.

Select Operations, then Run Action.

Then choose the action to run against each selected draft.


2 Likes

So I have not been able to get batch actions to do what I want. I have an action to add a draft to DayOne, but if I select more than one draft it will only run on the first one selected. I would like the script to work on each draft with the tag. Any suggestions or sample scripts? Thanks!

Can you share your Day One action?

My best guess currently is that you aren’t automatically returning to Drafts from Day One to process the next Draft in the set.

Since I don’t know how to do that, you are probably right, but here it is:

drafts5://action?data=%7B%22uuid%22:%22B3C00A62-C475-45BF-9A49-61D26A840208%22,%22steps%22:%5B%7B%22platforms%22:3,%22data%22:%7B%22script%22:%22draft.addTag(%5C%22journal%5C%22);%5Cndraft.update();%22%7D,%22type%22:%22script%22,%22isEnabled%22:true,%22uuid%22:%224D7334BF-D7AC-4D89-95FB-84FD0EBDFD2A%22%7D,%7B%22platforms%22:3,%22data%22:%7B%22useSafari%22:%22false%22,%22template%22:%22dayone2:%5C/%5C/post?entry%3D%5B%5Bdraft%5D%5D%22,%22encodeTags%22:%22true%22%7D,%22type%22:%22url%22,%22isEnabled%22:true,%22uuid%22:%22B5DB3053-4EE8-48A7-A2B1-826F88E50204%22%7D%5D,%22groupDisposition%22:1,%22shortName%22:%22%22,%22shouldConfirm%22:false,%22disposition%22:2,%22keyCommand%22:%7B%22optionKey%22:false,%22input%22:%22%22,%22controlKey%22:false,%22commandKey%22:false,%22type%22:%22action%22,%22discoverabilityTitle%22:%22Day%20One%22,%22shiftKey%22:false%7D,%22logLevel%22:2,%22notificationType%22:2,%22tintColor%22:%22indigo%22,%22actionDescription%22:%22Send%20draft%20as%20new%20entry%20in%20Day%20One.%22,%22keyUseIcon%22:true,%22icon%22:%22journal%22,%22visibility%22:2,%22groupUUID%22:%22EEFCA335-EDAF-4434-8535-FF1AAA199F50%22,%22assignTags%22:%5B%5D,%22name%22:%22Day%20One%22%7D

I’ve taken a quick look and that action’s just using a URL.

dayone2://post?entry=%5B%5Bdraft%5D%5D

You would probably want to look at using an x-callback URL instead; assuming DayOne supports that. Their help page on their URL scheme support unfortunately makes no mention of it and I’m not a DayOne user so I’m not in a position to test it myself.

Try swapping the URL step out for a Call back step and see if that makes a difference.

Thanks, but it seems Day One doesn’t have x-callback-url support. I’ve made it a feature request.