Hi Jon,
Please try the LifeCycleMessage with MarkComplete as the operation. (The documentation of LifeCycle operation probably needs to be improved)
Hope this helps,
Ophir
I am trying to mark a task as completed using the API. If the user credentials supplied matched the user that was the resource on the task, I believe that doing an UpdateMessage could work. I've tried creating the below update message (inside of a custom class that stored a Task's ExternalID as a property):
UpdateMessage um = new UpdateMessage()
{
Entity =
new Entity()
{
Id = new EntityId() { TypeName = "Task", Value = this.ExternalID },
Values = new FieldValue[]
{
new FieldValue() {FieldName= "PercentCompleted", Value = 100}
}
}
};
When executing this message, it says that it is successful, and if the "API user" is a resource, that person's % Completed on the task is updated. This is not really what I wanted, however. What I am really after is to have this execute as part of an SVN hook and if the message contains a keyword indicating that the task is complete, then the Task should be marked as such.
I have since tried using a LifecycleMessage to try to do a "Complete" operation on the Task, but that throws an Internal Error ().
LifecycleMessage um = new LifecycleMessage()
{
Ids =
new EntityId[]
{
new EntityId() { TypeName = "Task", Value = this.ExternalID }
},
Operation = "Complete"
};
I also tried a "Completed" operation, just to see what would happen and got another Internal Error. The documentation for LifecycleMessage lists the operation as a string, and just says "The operation to perform (Activate, Cancel, etc.)". It's the etc. that is less than helpful here.
Does anyone know of a way to accomplish what I'm trying to do? I've also tried updating the "State" field to "Completed" in the update query, but that throws an error as the State field is read only.
Please sign in to leave a comment.
Hi Jon,
Please try the LifeCycleMessage with MarkComplete as the operation. (The documentation of LifeCycle operation probably needs to be improved)
Hope this helps,
Ophir
Using MarkComplete as the lifecycle message worked! Thanks.
By any chance, could you provide me a list of the acceptable operations for a lifecycle message?