如何查询对象 UtilElements 和 UtilIdElements 以获取正确的结果?
我在 Dynamics AX 2009 中查询 UtilElements 和 UtilIdElements 时遇到问题。
屏幕截图 #1 显示 sys
、syp
层中存在 SalesFormLetter 类、gls
、glp
和 cup
。但是,当我运行以下代码时,输出显示该对象仅存在于 sys 层中。屏幕截图 #2 中给出了此代码的输出。
我在这段代码中做错了什么吗?我想知道给定对象存在的所有层。
提前致谢。
#AOT
UtilElements utilElements;
UtilIdElements utilIdElements;
;
info('Querying UtilElements...');
while
select utilElements
where utilElements.name == 'SalesFormLetter'
&& utilElements.recordType == UtilElementType::Class
{
info('Layer: ' + enum2str(utilElements.utilLevel) +
', Object type: ' + enum2str(utilElements.recordType));
}
info('Querying UtilIdElements...');
while
select utilIdElements
where utilIdElements.name == 'SalesFormLetter'
&& utilIdElements.recordType == UtilElementType::Class
{
info('Layer: ' + enum2str(utilIdElements.utilLevel) +
', Object type: ' + enum2str(utilIdElements.recordType));
}
屏幕截图 #1:
屏幕截图 #2:
I am having issues with querying UtilElements and UtilIdElements in Dynamics AX 2009.
Screenshot #1 shows the class SalesFormLetter being present in the layers sys
, syp
, gls
, glp
and cup
. However, when I run the following the code the output displays that the object exists only in the sys
layer. Output of this code is given in screenshot #2.
Am I doing something wrong in this code? I would like to know all the layers in which a given object is present.
Thanks in advance.
#AOT
UtilElements utilElements;
UtilIdElements utilIdElements;
;
info('Querying UtilElements...');
while
select utilElements
where utilElements.name == 'SalesFormLetter'
&& utilElements.recordType == UtilElementType::Class
{
info('Layer: ' + enum2str(utilElements.utilLevel) +
', Object type: ' + enum2str(utilElements.recordType));
}
info('Querying UtilIdElements...');
while
select utilIdElements
where utilIdElements.name == 'SalesFormLetter'
&& utilIdElements.recordType == UtilElementType::Class
{
info('Layer: ' + enum2str(utilIdElements.utilLevel) +
', Object type: ' + enum2str(utilIdElements.recordType));
}
Screenshot #1:
Screenshot #2:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还涉及其他元素类型,例如
UtilElementType::ClassStaticMethod
或UtilElementType::ClassInstanceMethod
。尝试运行这个:实际上,AOT 有点作弊以突出显示该类。类本身没有改变,但它的方法之一改变了。
There are other element types involved like
UtilElementType::ClassStaticMethod
orUtilElementType::ClassInstanceMethod
. Try running this:Actually the AOT is cheating a little to highlight the class. The class itself is not changed, but one of its methods is.