LiquidPlanner Classic Forum

Ask a Question
Back to All

Unable to remove Assignee via C# and the update_assignment API call

(edited)

Posted on behalf of Hasty. Original posting date 2015-01-20.

Been having the same issue as a few others I've seen on here where newly created tasks using the API will tack on multiple assignees to a task. In our specific case we're importing TFS items from our SW database and creating tasks within LP to track these -- problem is that it creates multiple owners, both the person assigned in TFS and the person's account we use to do the importing.

Yes, I understand that we'll need to update our code to create a task using the "assignments" as an array of owners. However, I also need to ensure that our tasks can be updated appropriately by adding and removing owners/assignees. This is my problem -- I cannot remove an owner.

I've updated our API.cs file, taken from the old C# API example (BTW, can you update your example to include the new API calls?), with the new Assignment class and it works for the most part (had some issues with the "activity_id"). When I get tasks (Item) I can see the appropriate data in the array of assignments, so that appears to be working.

public class Assignment

{
public Int32 id { get; set; } // unique id for assignment
public Int32 person_id { get; set; } // who owns the assignment
public Int32 treeitem_id { get; set; } // identifies treeitem to which the assignment belongs
public Boolean is_done { get; set; } // true if assignment done, otherwise false
public float low_effort { get; set; } // low end of estimate in hours
public float high_effort { get; set; } // high end of estimate in hours
//public Int32 activity_id { get; set; } // activity to apply to the remaining work, some issues with this
}

Reading the documentation shows that to remove an owner from the list of assignments requires that you make a POST call and specify 1) the assignment_id and 2) the person_id as null. I do so with the following code:

post("/workspaces/" + this.WorkspaceId + "/tasks/" + data.id + "/update_assignment", new
{
assignment_id = assign.id,
person_id = "null", // this apparently doesn't work.
});

The response from LP never sees a change in the person_id. Trying person_id = (object)null throws a (500) internal server error. My limited success in trying to use the update_assignments has only gone so far as to update the low & high efforts for a particular owner.

In a nutshell, I cannot remove an owner from a task no matter the combination of command object. Even trying to set is_done = "true" does not seem to work.

What am I doing wrong?

Thanks,

Joe.