Important notes/conclusions about models:
- Models are layer-specific
- Therefore a parent object (eg \Classes\SalesFormLetter\construct) may exist in the [Foundation] model in the SYS layer, but may also exist in the [USR Model] in the USR layer
- You can have unlimited models in any layer
- Models can contain objects that may be parents or children
- This code below tells you what model C\SalesFormLetter is in, in the SYS layer. If you have your own custom method in the CUS layer on this object, you will need to use SysDictMethod for example to identify it.
- You would need to reflect on the objects entirely to fully identify an object. This is proof of concept code
Models are very simple once you understand their concepts. They can appear daunting at first. You can use the TreeNode object to get the model.
static void jobGetObjectModel(Args _args) { SysDictClass sysDictClass = new SysDictClass(classNum(SalesFormLetter)); SysModel sysModel; SysModelManifest sysModelManifest; select Model, Name, Publisher, DisplayName from sysModelManifest where sysModelManifest.Model == sysDictClass.treeNode().AOTGetModel() join firstonly Layer from sysModel where sysModel.RecId == sysModelManifest.Model && sysModel.Layer == UtilEntryLevel::sys; // Change layer here if (sysModelManifest) info(strFmt("Model: %1", sysModelManifest.Name)); else info("Object is not apart of model in given layer"); }
No comments:
Post a Comment