Children Linking Order in Operation Advisor.
When linking child work items in an operation advisor, the list of children as seen from the parent links view is in a random order, even if the work items are being linked sequentially.
e.g.
What could be the issue?
The code used is this.
for (IWorkItem child : children) {
System.out.println("");
IWorkItemReferences references = saveParameter.getNewReferences();
List<IReference> allrefs = references.getReferences(WorkItemEndPoints.CHILD_WORK_ITEMS);
for (IReference iReference : allrefs) {
System.out.println(iReference.getLink() +" : "+ iReference.getComment());
}
workItemService.saveWorkItem2(child, null, null);
System.out.println(child.getId());
IReference newReference = IReferenceFactory.INSTANCE.createReferenceToItem(child,child.getHTMLSummary().getPlainText());
references.add(WorkItemEndPoints.CHILD_WORK_ITEMS, newReference);
}
When using the SYSOUT, the order is correctly displayed in the console. Just RTC is showing it as shown in the screen shot. Please Advise.
One answer
If you perform changes to a work item in an advisor you likely violate the interface. see https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/ . An advisor basically only advises e.g. prevents a save.
The order of elements in whatever list and the order of how they are displayed by a user interface are not necessarily the same. For example you get alphabetical order in some places.