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:
- 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.
- 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?
Here's the resulting script in a gist with the unique info redacted:
Here's what the script does:
- 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.
- Loops through each element and:
- Pulls out the task ID
- 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.