Hi! I recently started running into a problem with updating tasks with due dates. I am able to update the custom fields just fine, but I can’t add tasks with due dates to projects or move columns via the API. I can do those things with the same user account manually (aka not through the API). The script and user have not changed in months and worked fine up until 12/20 when the error started popping up daily, so I believe the change happened on Asana’s end.
For main tasks, I got a asana.error.ForbiddenError: Forbidden: Cannot add task to project due to task sharing permission settings of the target project or one of the task’s existing projects. As soon as I removed the due date from the task, the script ran without error and added the task to the project. The line of code throwing the error is this: result = client.tasks.add_project_for_task(df1[‘gid’][row], section, opt_pretty=True)
For subtasks, I have a subtask based project where the subtasks all have due dates and move columns based on a custom field. The custom field is updating normally, but the subtasks are not changing columns. As soon as I deleted a due date on a subtask that hadn’t moved in days, it moved columns appropriately. There is no error popping up for this, but it is ignoring the api call. Here is the code: meh_result = client.tasks.add_project_for_task(gid, section, opt_pretty=True). For reference, I printed out gid and section and they print out the expected response, so it knows what column it’s supposed to be going to.
Other than deleting all my due dates and hoping my users never add any ever again, is there a fix for this that will still allow me to reliably use the API?
This is absolutely the right problem. We had the same issue with a different circumstances (adding a project to a task that already had that same project); this used to work fine until recently. We use a very old version of the Python client (0.10.13), but nevertheless:
When the tasks exists and project A but not project B, calling asana.client.tasks.add_project(task_id, {'project': PROJECT_ID}) works fine
When the task belongs to both A and B and has a due date, the call fails with the error “asana.error.ForbiddenError: Forbidden: Cannot add task to project due to task sharing permission settings of the target project or one of the task’s existing projects.”
Removing project B from the task also works, however a second call puts us back in situation (2) above so this isn’t a workable solution
When the task belongs to both A and B but does not have a due date, the call works fine