Crmsql Statement Query Entity Form entity field Relationship information

Source: Internet
Author: User

How do you use SQL statements to query this information in CRM?

Querying entity information:

--Querying entity information, Entity name: Account
SELECT * from metadataschema.entity where name= ' account '

Query Form information:

--Query form information, Objecttypecode: Entity's code
SELECT * from systemform where Objecttypecode = 1

Query View information:

--Query View information, Returnedtypecode: Entity's code
SELECT * from savedquerybase where Returnedtypecode = 1

Query Field information:

--Query field information
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

Query Relationship information:
SELECT * from Metadataschema.relationship where Referencingentityid in
(select top 1 entityid from metadataschema.entity where name = ' New_store ')

Crmsql Statement Query Entity Form entity field Relationship information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.