UDO Access via DI API (in PL46)
One of the biggest changes in the DI API is the GeneralService, which enables you to access and update UDO data via the DI API. This feature was added to PL46 of 2007 A, which was released the last week of January.
I explain the basic ideas in this blog. You can also check out the code samples provided by Miki Zilbershtein.
UDOs and the DI API
User-defined objects (UDOs) enable you to create your own business objects and provide them with built-in services (add, update, delete, series and more) without needing to program.
Until now, the way you used UDOs is generally via the UI API: You created a form and connected your UDO to the form with the ObjectType property. The navigation bar and the Add/Update/Find buttons automatically worked with your UDO, and all validation worked in your form. The typical example is the Meal Orders form in the UDO samples that comes with the SDK:
But there was no way to access the UDO data via the DI API. You could use the Recordset object, but this did not provide any validation or take advantage of any of the services that come with UDOs (such as Series and Delete).
The GeneralService is pretty simple. You create a GeneralService object for a specific UDO, and then you can add, update, and delete records. The following shows how to add records for the MainUDO UDO:
The GeneralService also comes with the InvokeMethod, which lets you call a custom method in your implementation DLL. You call InvokeMethod, sending a string and an instance of a GeneralData object, which represents a UDO record. The GeneralService then calls the DLL’s InvokeMethod, if one has been implemented.
For more information, see the SDK Help Center that comes with the PL46 by installing the SDK from that patch. Then check out the What’s New page and the GeneralService is the DI API reference area.
It is unusual to add significant API changes to a patch, but 2007 A PL46 was an exception. Next week, I’ll list all the changes that were made, in addition to the GeneralService and its companion objects.