Java Server Side : How check if a comment has been add
Accepted answer
Hi Antoine,
I have code that adds a comment to a work item. I've poked around it, and it looks like you could do something like the following before saving the work item with a new comment:
Then after you save the work item, you could check that contents[numberOfComments].toString() is your comment.
I don't have an environment setup to see if getContents() is returning what I expect it will, so hopefully that will work for you (or at least get you started).
I have code that adds a comment to a work item. I've poked around it, and it looks like you could do something like the following before saving the work item with a new comment:
IComments comments= workItem.getComments();
int numberOfComments = comments.getContents().length;
Then after you save the work item, you could check that contents[numberOfComments].toString() is your comment.
I don't have an environment setup to see if getContents() is returning what I expect it will, so hopefully that will work for you (or at least get you started).