Instantiate a task from a task template under a section

I am trying to create a task, under a section, using a task template. I am able to successfully create a task from template and add it to a project, but haven’t been able to get it to go under a specific task.
I am using Node and the instantiate a task from a task template API documentation (https://developers.asana.com/reference/instantiatetask).

Here is my json I pass in:
‘body’: {
‘data’:
{
‘name’:‘Project name’,
‘projects’:[projectGid],
‘memberships’:[
{
‘section’:sectionGid,
‘project’:projectGid
}
],
}
}
I’ve checked that my variables do have the correct values.

For anyone else looking, I heard back from Asana support and this cannot be done. They say:
“The section would need to be directly set within the task template. Otherwise it will only be created on the top of the project. This is also the behavior within the product. This cannot be circumvented by API and you would sadly need to adjust this in the product directly.”

Actually not true. You can get the gid of the new task from the completed job record and do a subsequent API call to Add a project to a task to put it in the desired section. (Let me know if you need more details about this.)

2 Likes

Interesting. I will give this a shot and report back.

1 Like