How can I identify an Axapta class Name from the class ID?

前提是你 提交于 2019-12-10 16:44:08

问题


Please can someone help me make sense of the Batch madness?

I'm trying to debug an Axapta 3.0 implementation that has about 50 Batch Jobs. Most of the batched classes do not implement the description() method, so when you look at the Batch List form (Basic>>Inquiries>>Batch list) the description field is blank. You can see the Batch Group and the Start Time, etc. but you can't tell which class is actually being called.

The Batch table contains a hidden field called ClassNum which identifies the ID property of the class. Can anyone tell me how I can find the corresponding class from the ID? Once I've identified the culprits I can add descriptions.

I tried using the standard Find function on the AOT but it doesn't pick them up.

Any suggestions would be most welcome!

Many thanks, Mike


回答1:


Jay's answer provides two comprehensive solutions.

I've just discovered that the global class ClassId2Name does the same thing, so you can simply have:

display str Classname()
{
   return ClassId2Name(this.ClassNum);    
}



回答2:


There atleast two ways to do this, you can use the DictClass class:

display ClassName className()
{
    DictClass dictClass = new DictClass(this.ClassNum);
    ;
    if(dictClass!=null)
        return dictClass.name();
    return '';
}

Or using the UtilIdElements table:

display ClassName className()
{
    UtilIdElements utilIdElements;
    ;
    select utilIdElements where utilIdElements.id==this.ClassNum && utilIdElements.recordType==UtilElementType::Class;
    if(utilIdElements)
        return utilIdElements.name;
    return '';
}


来源:https://stackoverflow.com/questions/177258/how-can-i-identify-an-axapta-class-name-from-the-class-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!