I’m trying to create an action to toggle between 2 possible tags. Basically, if a Draft has “tag1”, I’d like to switch it to “tag2” and visa versa.
I can’t find anything in the Action Directory that does this (or something similar that I can hack around with). Can anyone suggest a plan of attack?
A script step like this should give you the basis for it I think.
let strTag = "foo";
if (draft.hasTag(strTag)) draft.removeTag(strTag);
Just account for it not being one tag but two and so you need to do an add and remove each time.
But also what happens should you inadvertently have both or neither…?
Hope that helps.
That does the trick quite nicely. Thanks so much for the help!
(I’m not worried about if the Draft already has both or neither tag - if it was being built for other users, maybe.)