AurelyenD Posted February 27, 2018 Report Share Posted February 27, 2018 Hi, I'm searching a way to update Task status when launching a particular action. (the Action launches After Effects, and I want the task's status to be updated from Not Started to In Progress) I tried : task.setStatus("In Progress") >>>> AttributeError: 'Task' object has no attribute 'setStatus' I tried : task['status']['name'] = "In Progress" => it changes the name of the status in the UI. And I have to go to the system settings / statuses to revert this. I understand I change the display name of the status object itself, and not the status / state of the task. I tried : status = session.query('Status').all() my_task['status'] = status[8] session.commit() I wanted to set the status attribute with a Status Object, but... >>>> ftrack_api.exception.ServerError: Server reported error: PermissionError(Permission denied: not allowed to 'update' 'StatusType'. Operation 'update' can never be done on 'StatusType'.) I'm sure (actually I hope...) I'm missing something trivial... Any help appreciated ^^ Thanks. Link to comment Share on other sites More sharing options...
Eric Hermelin Posted February 27, 2018 Report Share Posted February 27, 2018 Hi, Your second example looks right, I wounder if you could have had something else in your session when you committed? Could you try the code below, the only difference here is that we make sure the status is valid for the tasks project. session = ftrack_api.Session( auto_connect_event_hub=False ) task = session.query( 'select project.project_schema from Task' ).first() valid_statuses = task['project']['project_schema'].get_statuses( 'Task' ) task['status'] = valid_statuses[0] session.commit() cheers Eric Link to comment Share on other sites More sharing options...
AurelyenD Posted February 27, 2018 Author Report Share Posted February 27, 2018 got my answer from a post sent almost in the same time (https://forum.ftrack.com/topic/1225-how-do-we-createset-a-status-on-a-milestone-using-the-new-python-api/) One has to use the 'status_id', not 'status' key: my_task['status_id'] = status_list[9]['id'] Thanks Mattias Lagergren for the solution ! Link to comment Share on other sites More sharing options...
AurelyenD Posted February 27, 2018 Author Report Share Posted February 27, 2018 Hi Eric. I closed the session to be sure no there is nothing problematic in my commit. Your solution posted above worked fine. So you're right, I was having issues in the commit that were throwin errors. When status are not valid for the task, the error message is explicit, so that was not the problem. Quote Server reported error: ValidationError(Object "Task" cannot have status "Client approved".) Thanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.