Copy tasks using API

We're looking into using the Wrike API for task creation. We have several templates that consist of tasks with subtasks and dependencies. Is there a way to programmatically copy/duplicate a task like in the interface? I know you can copy folders, but we need to copy individual tasks. Thanks!

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
5 commenti

We have a similar need. One of our requests forms currently creates a task for our IT team, but in certain cases we also need to create a second task with subtasks for another team. We're looking at doing this with Wrike Integrate, but so far have not found any way to access Blueprint tasks in order to accomplish this need.

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Max Zeryck - We successfully got this working yesterday using Wrike Integrate, but the steps should be the same for a straight API approach.

The one thing we had to sacrifice was using the Blueprints feature, since the API doesn't support that yet. So, we moved the templates we need to copy back into a 'Templates' space.

It's pretty much what you'd expect... since there isn't a "copy task" method, we have to do it all manually.

  1. Get the template task by ID
  2. Create a new task in the appropriate target folder, populating with data from step 1 (title, description, assignee, dates, etc.)
  3. Loop through the subTaskIds array. For each subtask, repeat steps 1 & 2 (setting the superTasks array accordingly to ensure the subtask is attached to the task created in step 2)

 

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Laura Boylan Thanks for sharing your insight! We had also just moved everything into Blueprints, it's too bad it's not in the API yet. That's a good solution to the issue that still keeps templates available for regular Wrike users in our organization.

Our other thought was to just keep the "templates" outside of Wrike, and store the logic in some intermediary format. That way we're not hitting the API that many times, especially since we use a ton of dependencies and those are all individual API calls. Obviously, the downside with this approach would be that Wrike users wouldn't be able to use those templates anymore.

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Max Zeryck - So far, our Wrike Integrate solution works for us, with one annoyance that I wanted to note in case it matters to you (or to others reading this thread)... the resulting subtasks are listed on the task in reverse order.

It's important for our team that the subtasks are shown in alphanumeric order by title, and we number them in the titles, such as:

1. First subtask

2. Second subtask

3. etc...

They're currently getting created in reverse order apparently, so the resulting task shows them as:

3. etc...

2. Second subtask

1. First subtask

I think this is an oddity specific to how Wrike Integrate loops through the subtasks, as there doesn't appear to be any built-in Wrike Integrate option for sorting this list. I also think we can work around it by creating a Wrike custom action so we can generate our own API call(s). Just something to be aware of...

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

If any other Wrike Integrate users have a similar need (copy a Wrike template task with subtasks, where the resulting task's subtasks need to be in the same order as they are on the original template task), here's a sample recipe demonstrating the solution we came up with.

https://www.workato.com/recipes/1035745-create-a-copy-of-a-wrike-template-task-with-subtasks-where-subtask-sort-order-on-copied-task-matches-the-template-task

 

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Folllowing List for Post: Copy tasks using API
[this list is visible for admins and agents only]

Su
Didn’t find what you were looking for? Write new post