Operation Advisor Plugin- ID skipping while error ?
![]()
Hello
I come across a weird error during operation advisor development. The code is simple checking the Parent for the Task and If the parent is not present it ask user to have a parent before save. But If the error occurs the system consumes the ID for the workitem and after providing parent the Task has been created with the Next ID. Story Created. : ID=1002 Task Created without Story as Parent : Error to User Provided the Story as Parent : save successfully but the ID is 1004 instead of 1003. Searching for 1003 no work item found. Even If I click the save multiple times it keeps skipping the IDs equal to that of. a short scenario for my code is Inside the Process Advisor I have created an method and simply calling this from the run method. if the work item type is task private boolean processTask(IWorkItem workItem, Object data, IRepositoryItemService repositoryItemService, IAdvisorInfoCollector collector) throws TeamRepositoryException { IItemHandle referencedItem = null; IWorkItem relatedWorkItem = null; // Checking for the parent List<IReference> parentRef = ((ISaveParameter) data).getNewReferences() .getReferences(WorkItemEndPoints.PARENT_WORK_ITEM); // if no parent created boolean isProblem = false; if (parentRef.size() == 0) { isProblem = true; } else if (parentRef.get(0).resolve() instanceof IWorkItemHandle) { for (IReference reference : parentRef) { if (reference.isItemReference()) { referencedItem = ((IItemReference) parentRef.get(0)) .getReferencedItem(); relatedWorkItem = (IWorkItem) repositoryItemService .fetchItem(referencedItem, null); if (!taskParentTypes.contains(relatedWorkItem .getWorkItemType())) { isProblem = true; } } } } if (isProblem) { IAdvisorInfo info = collector .createProblemInfo( "Error: Missing Parent -Story", "Task can not be created without Parent Story Work Item", "error"); collector.addInfo(info); } } |
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.