Passing tags to new "update item metadata" shortcuts action

I want to pass a list of tags to the shortcuts action.

The interface allows for adding one tag at a time manually in the parameters to the action. However I generate a list of tags at run time into a variable that I would like to pass to DTTG.

This works via the x-callback url if I comma separate my tags, e.g. “tag1,tag2” adds two tags: tag1 & tag2.

If I pass the same variable to the action, then I get a single tag created which is “tag1,tag2”.

Is there any way to pass a variable containing multiple tags to the new action?

I hope so, since it’s easier to code and runs faster, perhaps because I don’t have to URL encode the parameters.

I found that I can programmatically create a list in Shortcuts and pass that list (instead of a comma separated string) as a variable with success.

In retrospect that makes sense, and what I would have tried had I not been fixated on the URL parameter format.

Can you post a screen capture of the routine in the shortcut you used?

Here are two screenshots. First, setting the itemTags variable, then using it to update the metadata.

and this adds the single tag tag1,tag2 to the item in DTTG.


@pfarrelle can i ask how you are creating lists and succeeded in getting multiple tags? Maybe a screenshot of the working shortcut?

Unfortunately I never did.

To summarize: At the time I could add multiple tags via the url scheme but in shortcuts I get a single tag that contains “tag1, tag2” instead of two tags: “tag1” and “tag2”.

I really wanted to be able to read/modify/update tags via shortcuts, as I do in AppleScript, but that also wasn’t possible.

I don’t have a solution other than having to do those tasks at my Mac which is very inconvenient at times.

I haven’t retried in the last 9 months, and am unable to do so right now, but I would love to see this functionality added via shortcuts.

This is possible via a Repeat.

Jim - I appreciate you pointing out the repeat process, but any more thoughts on the ability to retrieve tags, modify tags, then write back the modified tags, all in shortcuts?

My example is all in a shortcut, including retrieving the tags.

Adding tags expects a list, even a list of one item. So you passsing some,text or `some;other;text’ is just a string line item in the list. My approach resolves the issue and is still performant since it’s a pretty low level operation for the loop to handle.

Hi @BLUEFROG. I’m trying to reproduce the shortcut you have shown us here but I am missing what’s going on inside the Update Item Metadata action.

Everything I’ve tried just overwrites the existing tag(s) on each repeat loop (so I end up with just the final tag on its own).

Update: I answered my own question. You just need to pass the list of tags as a list (not just as text) to the action field as shown here: List of feature requests for iOS (and future macOS) Shortcut actions - #9 by BLUEFROG

I thought I tried this but I must have been confused…