Welcome to the Jazz Community Forum
Issues programatically creating approval records

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
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

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.
You can use the active piece with a WorkItemOperation as well with your own workingcopy code.
One other answer

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;
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;