crmsql句子的实体关系实体字段的信息窗口

在crm里面怎样用sql语句查询这些信息?

查询实体信息:

--查询实体信息,实体名称:account
select * from MetadataSchema.Entity where name= 'account'

crmsql句子的实体关系实体字段的信息窗口

查询窗口信息:

--查询窗口信息,ObjectTypeCode: 实体的code
select * from systemform where ObjectTypeCode = 1

crmsql句子的实体关系实体字段的信息窗口

查询视图信息:

--查询视图信息,ReturnedTypeCode:实体的code
select * from SavedQuerybase where ReturnedTypeCode = 1

crmsql句子的实体关系实体字段的信息窗口

 

查询字段信息:

--查询字段信息
with attr as(
   select * from MetadataSchema.Attribute as a 
   where a.EntityId in (select entityid from MetadataSchema.Entity 
   where name = 'new_member') and a.IsCustomField = 1 

select a.attributeid,a.Name,label.Label,ty.Description,
(select top 1 name from MetadataSchema.Entity where EntityId in (
select ship.ReferencedEntityId from MetadataSchema.Relationship as ship 
 where ship.ReferencingAttributeId = a.AttributeId)) as 'lookName'
from attr as a inner join MetadataSchema.LocalizedLabel as label
on a.attributeid = label.objectid inner join MetadataSchema.AttributeTypes as ty
on a.AttributeTypeId = ty.AttributeTypeId
where label.objectcolumnname = 'DisplayName' and a.validforcreateapi = 1

crmsql句子的实体关系实体字段的信息窗口

查询关系信息:
select * from MetadataSchema.Relationship where ReferencingEntityId in 
(select top 1 entityid from MetadataSchema.Entity where name = 'new_store')

crmsql句子的实体关系实体字段的信息窗口

 

 

版权声明:本文博客原创文章,博客,未经同意,不得转载。






本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/4655628.html,如需转载请自行联系原作者


相关文章:

  • 2021-10-26
  • 2022-03-05
  • 2021-11-17
  • 2021-08-10
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-01-04
猜你喜欢
  • 2022-12-23
  • 2021-11-25
  • 2021-08-23
  • 2022-01-03
  • 2021-11-25
  • 2022-12-23
  • 2021-07-24
相关资源
相似解决方案