Hackers Guide to Bulk-Changing the Task Stage of Wrike Subtasks

wrike-code

Some times I want a piece of web software to do a thing that it doesn't do. And sometimes the fact that it doesn't do that thing is a big enough waste of my time, that I go right to hacking away at it with the Chrome console to see if I can make it behave. And usually, it works. This is a story about one of those times.

We currently use Wrike for project management here at Story Block. Wrike is good for a lot of things, but every now and then it's frustratingly devoid of certain productivity features -- to be fair, any and all project management systems are likely to have blindspots. The other day, I was creating a Wrike task with on the order of 30 subtasks. Everything was going fine, until I realized that I had created the subtasks under an incorrect task stage (workflow phase? task phase? who knows...).

Did you know that changing 30 subtasks within Wrike can only be done one at a time? 

Well, I'm triggered by the phrase "one at a time" -- it's not something that I want to do.

What I do want to do is write code. So I went for that.

Writing some code to automate this task consists of a few steps:

  1. Open Google Chrome Console and observe a sample request from the network panel that does what I want it to do -- in this case, it marks a task as having a certain task phase.
  2. From this observation, look into what is required to replicate that network request with different information -- eg. what piece of information can I swap out to mark a different task with that same task phase?
  3.  Use javascript from the Chrome console to select elements on the page that have the information I need to replicate the request for each task as needed.

Here's the resulting script in a gist with the unique info redacted:

Here's what the script does:

  1. Uses jQuery (which is already put on the page by Wrike) to select all the links on the page matching the a[wrike-task-view-row-info-plate] selector.
  2. Loops through each element and:
    1. Pulls out the task ID
    2. Uses the task ID to make an Ajax request to the relevant endpoint, with the relevant data.

All in all, I'd say I saved myself some time. Although, writing this blog post about my adventure took about five times longer than actually writing the code, but sometimes telling the story is worth the effort. 

I should note that the above script was only tested in an up-to-date version of Chrome, and that it uses some modern Javascript features that may not be available in other browsers. Of course, run this script solely at your own risk. Your mileage may vary.

New call-to-action