插件获取运行期元数据原创
金蝶云社区-生态
生态
12人赞赏了该文章 4,100次浏览 未经作者许可,禁止转载编辑于2021年01月27日 10:10:53

MainEntityType mainType = this.getModel().getDataEntityType();

FormMetadata formMeta = (FormMetadata)MetadataDao.readRuntimeMeta(MetadataDao.getIdByNumber(mainType.getName(), MetaCategory.Form), MetaCategory.Form);

获取基础资料的type

  DynamicObject bas = (DynamicObject) this.getModel().getValue("基础资料字段");
  IDataEntityType type = bas.getDataEntityType();
  if (type instanceof BasedataEntityType) {
   BasedataEntityType basedataEntityType = (BasedataEntityType) type;

}

获取字段的属性,如可见性、背景色等

   for(ControlAp control:formMeta.getItems()) {
    if(control instanceof FieldAp) {
     control.getVisible();
     control.getBackColor();
    }
   }

赞 12