It's all about the answers!

Ask a question

Issues programatically creating approval records


Cindy Luk (1311) | asked Sep 28 '12, 3:10 p.m.
Here is the code snippet:
            IApprovals approvals= workItem.getApprovals();
            approvals.createDescriptor(WorkItemApprovals.VERIFICATION_TYPE.getIdentifier(), "Verification Record");
            IApproval approval= approvals.createApproval(descriptor, reviewer);
            approvals.add(approval);

I am getting the following error on the createDescriptor line.
com.ibm.team.repository.common.internal.ImmutablePropertyException

From my research so far, that exception usually can be fixed by using the workItemCopy.  However, approvals and Iapprovals doesn't like workitemcopy.

Any ideas on how to resolve this issue?
Thx

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Oct 01 '12, 6:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Cindy, approvals do like working copies, as far as I can tell. The example code here should work for you: http://rsjazz.wordpress.com/2012/10/01/adding-approvals-to-work-items-using-the-plain-java-client-libraries/

You can use the active piece with a WorkItemOperation as well with your own workingcopy code.


Cindy Luk selected this answer as the correct answer

One other answer



permanent link
Cindy Luk (1311) | answered Oct 02 '12, 2:46 p.m.
Thanks for the information.  I now have working code.
It turns out my issue was having an incorrect import statement.  The correct imports are as follows:
import com.ibm.team.workitem.common.model.IApproval;
import com.ibm.team.workitem.common.model.IApprovalDescriptor;

The incorrect import is this:
import com.ibm.team.workitem.common.template.IWorkItemDescriptor.IApproval;

Comments
Ralph Schoon commented Oct 02 '12, 3:49 p.m. | edited Oct 02 '12, 3:49 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Cindy, please accept the answer then. (The check mark underneath the vote down).

FYI , I ran into an issue recently, where I had an incorrect issue too. It appears that agile planning .apt. has classes with conflicting names too. Thanks for the information.

Your answer


Register or to post 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.