Error happended "The userId is null" when creating a work item whose type is "Task" via Java plain API
![]()
First: I can connect to RTC server v4.0.2
Second : I can create a work time whose type is "Epic" Third: I cannot create a work item whose type is "Task" by following code. Why can I create Epic work item but Task? And when RTC server is V4.0.0.1, everything worked. Now RTC server is upgraded to V4.0.2, it doesn't work for "Task" work item. private IWorkItem createWorkItem(WorkItemDetail workitem,IIteration sprint,ICategoryHandle category) throws WICException { try{ IWorkItemType workItemType = null; // if work item type doesn't change, don't need to create new one. // the work item type is reset to null for each epic. if (workItemType == null || !workItemType.getDisplayName().equals( workitem.getWorkitemType())) { if (workitem.getWorkitemType().equalsIgnoreCase(TemplateConstants.SPRINT)) { // in spreadsheet, the sprint will be created as epic. workItemType = getWorkitemTypeById(projectArea, TemplateConstants.EPIC); } else { workItemType = getWorkitemTypeById(projectArea, workitem.getWorkitemType()); } } WorkItemInitialization operation = new WorkItemInitialization( workitem, category, teamRepository, priorityMap, sprint, storyPointAttr); IWorkItemHandle handle = operation.run(workItemType, null); } Error happened when executing this line " IWorkItemHandle handle = operation.run(workItemType, null);" Error is: java.lang.IllegalArgumentException: The userId is null at com.ibm.team.repository.client.internal.ContributorManager.fetchContributorByUserId(ContributorManager.java:224) at com.ibm.workitemCreator.rtc.WorkItemInitialization.findContributorByName(WorkItemInitialization.java:125) at com.ibm.workitemCreator.rtc.WorkItemInitialization.execute(WorkItemInitialization.java:86) at com.ibm.team.workitem.client.WorkItemOperation.execute(WorkItemOperation.java:85) at com.ibm.team.workitem.client.WorkItemOperation.doRun(WorkItemOperation.java:272) at com.ibm.team.workitem.client.WorkItemOperation.run(WorkItemOperation.java:242) at com.ibm.team.workitem.client.WorkItemOperation.run(WorkItemOperation.java:189) at com.ibm.workitemCreator.rtc.RTCClientManager.createWorkItem(RTCClientManager.java:425) |
One answer
![]()
Sorry code is following exactly:
private IWorkItem createWorkItem(WorkItemDetail workitem,IIteration sprint,ICategoryHandle category) throws WICException { try{ IWorkItemType workItemType = null; // if work item type doesn't change, don't need to create new one. // the work item type is reset to null for each epic. if (workItemType == null || !workItemType.getDisplayName().equals( workitem.getWorkitemType())) { if (workitem.getWorkitemType().equalsIgnoreCase(TemplateConstants.SPRINT)) { // in spreadsheet, the sprint will be created as epic. workItemType = getWorkitemTypeById(projectArea, "Epic"); } else { workItemType = getWorkitemTypeById(projectArea, "Task"); } } WorkItemInitialization operation = new WorkItemInitialization( workitem, category, teamRepository, priorityMap, sprint, storyPointAttr); IWorkItemHandle handle = operation.run(workItemType, null); } BTW, other variables are correct types because I created "Epic" work item via that code. |
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.