Action is hanging after completion

I’ve made an Action to streamline the creation of Due Reminders I regularly set for scheduled file transfers to a client’s server. I’ve based it on the “Smart Reminder in Due” Action posted to the Action Directory by @mattbirchler.
I tacked on a few prompts at the front to gather the info for the new Reminder, and for the most part, it works. But there’s one problem; when I run the Action and it has been completed, I can’t run it right away again. I get a little progress (waiting?) wheel beside the Action in the Action menu. A couple of minutes later, the Action triggers.
Here’s a link to my action. I’m wondering if anyone can see a reason there should be a delay introduced by running this Action the first time. I wonder what’s hanging it up?

Any advice is appreciated. Thanks!

The action is using a CallbackURL object to make an x-callback-url call to Due. That causes Drafts to wait for a response from Due to come back via the x-success, x-error parameters specified by x-callback-url. So the delay is Drafts waiting to get a response from Due.

The action is, however, using the non-x-callback-url version of Due’s URL scheme, so, presumably this action ends in Due and never returns to Drafts to finish the action.

If you want to return to Drafts and finish the action, try change the URL in the script, like:

// var baseURL = "due:///add"; << wrong URL
var baseURL = "due://x-callback-url/add";

Did not try, but the suggestion based on my reading of the Due URL scheme docs.

If you want to remain in Due, you could also construct a plain URL, but call it with app.openURL instead of using CallbackURL.

1 Like

Problem solved.
Thanks Mr. Turtle!

1 Like