Validation errors for item: type = WorkItem - When adding Comments to a Work Item programatically.
![]()
Muthukumar C (327●1●28●33)
| asked Jul 10 '12, 7:07 a.m.
retagged Jul 25 '12, 9:04 p.m. by Millard Ellingsworth (2.5k●1●24●31)
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 |
Accepted answer
![]()
w.r.t the error that you are facing:
comment.setCreationDate(); You can assign a value to this date attribute. Muthukumar C selected this answer as the correct answer
|
6 other answers
![]()
Hi Muthukumar,
What does CmtMsg refer to? Any additional validation scripts (or) pre-conditions enabled? I have 1 query, Instead of the loggedin contributor, if we want to add a handle to another user, which method should eb used? (Instead of GetAuthenticatedContributor()) Thanks. |
![]()
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 |
![]()
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? |
![]()
I have another query relating to approvals:
Is it possible to make the approval presentation read-only? - as i want to update it only through Java API. Users should not be able to update it. Thanks. |
![]()
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 |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.