Hi there and thank you for helping me! I’ve went through every single “solution” I could find but nothing works! You see, on my asana project I have on every task a custom field, its a dropdown and its just for status updates “Not Started”, “In Progres”… “Completed” etc. I have IDs of all of those and I can create a task and set all that and it all works fine and dandy, but updating a task does not work no matter what, here is test code
I use SDK v3 NodeJs, I use asana@3.0.10
const Asana = require(‘asana’);
const asanaClient = Asana.ApiClient.instance;
const token = asanaClient.authentications[‘token’];
token.accessToken = process.env.ASANA_TOKEN;
const tasksApi = new Asana.TasksApi();
const taskID = ‘MYID’;
const customFieldID = ‘CUSTOMFIELDID’;
const newStatusID = ‘NEWSTATUSID’;
async function updateTaskStatus() {
try {
const updatePayload = {
data: {
custom_fields: {
[customFieldID]: newStatusID
}
}
};
console.log('Update Payload:', JSON.stringify(updatePayload, null, 2));
const response = await tasksApi.updateTask(taskID, updatePayload);
console.log('Update Response:', response);
} catch (error) {
console.error('Error updating task status:', error.response ? error.response.data : error.message);
}
}
updateTaskStatus();
It never works, I always get “Error updating task status: Cannot read properties of undefined (reading ‘hasOwnProperty’)”
IMPORTANT: I tried formatting the json in every way possible, i looked at all of the forum posts of similar issues but no matter what it doesnt work.
const updatePayload = {
“data”: {
“custom_fields”: {
customFieldID: newStatusID
}
}
};
I tried it this way too doesnt work, and yes i even tried the other “solution”
const updatePayload = {
“data”: {
“custom_fields”: {
customFieldID: newStatusID
}
“name”: “taskname”
}
};
My IDs are all correct, And I just can’t find the solution…
I appreciate your help!