I wondered if there was a way of getting the previous workorder associated with a unit without having to use unit.History and then stripping the text out. The ultimate aim is when the user has a workorder open they run a report which extracts pertinetent information for the current work order plus the service notes from last time. Realise that can right click the serial number form the service screen and then look at previous jobs and run a report that way, however attemtping to come up with a more elegant solution !!
Hi Martin, you could use the workoder service item list filtered by the Unit Id, just like you would do manually in the UI grid (though I don’t know if that’s an improvement over scraping the unit history), something like this:
Guid unitId = new Guid("{FC46F50E-7944-4B40-B307-59EE34145BD5}");
You can iterate them like this: foreach(WorkorderServiceItemList.WorkorderServiceItemListInfo i in wisl) { i.oneOfManyFieldsHere; //etc}
You can build a starter grid criteria in the UI then get the actual code to use by using the ctrl-alt-g command from the main grid. Remember this is Items so there could be dupes of the same workorder etc.