Can't save work item ( Java API - Server Side )
![]() I have this code
private boolean updateParent(ISaveParameter saveParameter, List<IWorkItemHandle> childs_handle,IProgressMonitor monitor) throws TeamRepositoryException {
String child_update = "";
IWorkItem parents = (IWorkItem)saveParameter.getNewState();
IAttribute Prodd = fWorkItemCommon.findAttribute(
parents.getProjectArea(), Product_Name,
monitor);
for (IWorkItemHandle childs: childs_handle){
IWorkItem child_workitem = (IWorkItem) fWorkItemServer
.getAuditableCommon()
.resolveAuditable(childs, IWorkItem.FULL_PROFILE, monitor)
.getWorkingCopy();
Object x = childValue(parents,child_workitem,monitor);
child_update = child_update + " " + x .toString();
}
IWorkItem parent= (IWorkItem)fWorkItemServer.getAuditableCommon().resolveAuditable(parents ,IWorkItem.LARGE_PROFILE,monitor).getWorkingCopy();
parent.setValue(Prodd, child_update);
// Save the work item with an information that could be used to prevent
// recursive ascent.
Set<String> additionalParams = new HashSet<String>();
additionalParams
.add(UPDATE_PARENT_EXTENSION_ID);
IStatus saveStatus = fWorkItemServer.saveWorkItem3(parent, null, null,
additionalParams);
if (!saveStatus.isOK()) {
return false;
}
return true;
}
private Object childValue(IWorkItem parents, IWorkItem child, IProgressMonitor monitor) throws TeamRepositoryException {
IAttribute Prod_pre = fWorkItemCommon.findAttribute(
parents.getProjectArea(), Product_pre,
monitor);
Object x = child.getValue(Prod_pre);
return x;
}
When I tried to run the API I got this kind of error:
|
Be the first one to answer this question!
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.