Validation errors for item: type = WorkItem - When adding Comments to a Work Item programatically.
Hi All,
I am getting the error message
com.ibm.team.repository.common.validation.PropertyConstraintException: Validation errors for item: type = WorkItem, itemId = [UUID _AIwpoLuhEeGplK6EoWL7QQ]
Required property must not be null: internalComments.creationDate
When appending the Comments to an Work item from java API.
following is the Sourec I am using for appending the comment...
XMLString CmtMsg = XMLString.createFromPlainText(StrComment);
System.out.println("StrComment : " + StrComment);
IComments comments = sourceworkItem.getComments();
IComment comment = comments.createComment(getAuthenticatedContributor(), CmtMsg);
comments.append(comment);
Note : I am using a Server side plugin and I am adding a Comment to a WI which is currently getting saved. hence I am not using the Working copy concept.
Thanks..
Regards
Muthukumar.C
I am getting the error message
com.ibm.team.repository.common.validation.PropertyConstraintException: Validation errors for item: type = WorkItem, itemId = [UUID _AIwpoLuhEeGplK6EoWL7QQ]
Required property must not be null: internalComments.creationDate
When appending the Comments to an Work item from java API.
following is the Sourec I am using for appending the comment...
XMLString CmtMsg = XMLString.createFromPlainText(StrComment);
System.out.println("StrComment : " + StrComment);
IComments comments = sourceworkItem.getComments();
IComment comment = comments.createComment(getAuthenticatedContributor(), CmtMsg);
comments.append(comment);
Note : I am using a Server side plugin and I am adding a Comment to a WI which is currently getting saved. hence I am not using the Working copy concept.
Thanks..
Regards
Muthukumar.C
Accepted answer
6 other answers
Hi Valli,
CmtMsg is nothing but a XMLString variable formed from a String variable.. Refer 1st line of my code. No additional validations are there related to this comment adding operation...
Regarding your query, the method is
IContributorService IConService = getService(IContributorService.class);
IContributorHandle user = IConService.fetchContributorByUserId("existinguserid");
AnyWorkItem.getSubscriptions().add(user);
System.out.println("UserID : Your UserID is added as subscriber");
Regards
Muthukumar.C
CmtMsg is nothing but a XMLString variable formed from a String variable.. Refer 1st line of my code. No additional validations are there related to this comment adding operation...
Regarding your query, the method is
IContributorService IConService = getService(IContributorService.class);
IContributorHandle user = IConService.fetchContributorByUserId("existinguserid");
AnyWorkItem.getSubscriptions().add(user);
System.out.println("UserID : Your UserID is added as subscriber");
Regards
Muthukumar.C
Hi Muthukumar,
Thanks. I am actually trying to create an approval item. Do you know how to add multiple approvers to an approval item programatically? My code is :
IContributorService IConService = getService(IContributorService.class);
IContributorHandle user = IConService.fetchContributorByUserId("ccm_user");
IApprovals approvals= sourceworkItem.getApprovals();
IApprovalDescriptor descriptor= approvals.createDescriptor(WorkItemApprovals.APPROVAL_TYPE.getIdentifier(), "Lead Developer Approval");
IApproval approval= approvals.createApproval(descriptor, user);
approvals.add(approval);
createApproval method allows only 1 contributor handle. How to add multiple approvers?
Thanks. I am actually trying to create an approval item. Do you know how to add multiple approvers to an approval item programatically? My code is :
IContributorService IConService = getService(IContributorService.class);
IContributorHandle user = IConService.fetchContributorByUserId("ccm_user");
IApprovals approvals= sourceworkItem.getApprovals();
IApprovalDescriptor descriptor= approvals.createDescriptor(WorkItemApprovals.APPROVAL_TYPE.getIdentifier(), "Lead Developer Approval");
IApproval approval= approvals.createApproval(descriptor, user);
approvals.add(approval);
createApproval method allows only 1 contributor handle. How to add multiple approvers?
I did that already. But unfortunately setCreationDate method is available only in Comment type and not in IComment.
So I did the following
((Comment)comment).setCreationDate(CurrentTimeStamp);
Thanks!!!
Will revert back to your query asap.
Regards
Muthu
So I did the following
((Comment)comment).setCreationDate(CurrentTimeStamp);
Thanks!!!
Will revert back to your query asap.
Regards
Muthu
Comments
Hi Muthukumar,
I tried a scenario for dependent enumerations involving a muti-select list:
Source: Enumeration
Target: medium string (multi-select list referring an enumeration)
Created a value-set between the 2 enumerations.
How to associate the value-set? Since string type does not have value-set enabled. Please advise
I tried a scenario for dependent enumerations involving a muti-select list:
Source: Enumeration
Target: medium string (multi-select list referring an enumeration)
Created a value-set between the 2 enumerations.
How to associate the value-set? Since string type does not have value-set enabled. Please advise