I have an action that allows me to create a pre-populated template that I use to make Letterboxd reviews. Here’s a link to the action: https://directory.getdrafts.com/a/2M4. Here are the basic steps:
- Bring up a prompt asking for a movie title.
- Bring up a script-created prompt that allows me to select multiple tags to include with the review. The tags list is contained in a previous script step.
- Create a new draft with my selected information placed into the body.
Before version 40, I didn’t have any issue with this action. Everything would populate correctly. Since version 40, the tags I select are not placed into the final draft creation step.
For illustrative purposes:
I’ve done nothing to change this action, so I’m at a loss as to why this is happening (allowing, of course, for my scripting illiteracy to be the reason why this isn’t working).
Any help with getting the tags to resume being placed into the new drafts I make (and receiving a much-needed scripting lesson) would be much appreciated.
—Sean
Could you share the action itself? You can share to the Action Directory as unlisted and share the link. Hard to comment without seeing the script.
Also, any message in the action log after running? The biggest possibly related change in v40 is increased strictness and logging around required parameters in Drafts’ function - but any issues with those parameters would be logged.
Sorry, I thought I had included the action in my post. My mistake. I believe this should be it: New Letterboxd Review | Drafts Directory
The Action Log states “Draft.setTemplateTag: Invalid tag name and value strings”.
Yes, you got hit by stricter parameter checking. That last line passing an array value to a method that wants a string. The stricter checking was necessary to avoid situations where things that could not be coerced would cause crashes. This should work instead, by making the passed value a string:
// Change this…
draft.setTemplateTag("tags", tagSelections);
// to this…
draft.setTemplateTag("tags", tagSelections.join(", "));
Thank you so much for the detailed explanation and the updated code. Not only did it work perfectly, but I did in fact learn something new today.
I really appreciate your time and help!
1 Like