最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is it possible to fetch all the relationships available for an entity from CRM using web api? - Stack Overflow

programmeradmin1浏览0评论

I have a requirement to fetch and show all the available Relationships of an Entity on HTML page, separately. Eg: If I chose, Account, in the html page, I should be able to see 1:N, N:1 and N:N relationships of Account Entity.

I have tried below, queries and I feel, these are not helping me correctly, Please suggest me a workaround for this to achieve.

https://<CRMORGNAME>/api/data/v8.2/RelationshipDefinitions/Microsoft.Dynamics.CRM.ManyToOneRelationshipMetadata?$select=Entity1LogicalName,SchemaName&$filter=Entity1LogicalName eq 'account'

https://<CRMORGNAME>/api/data/v8.2/RelationshipDefinitions?$select=RelationshipType,SchemaName

I have a requirement to fetch and show all the available Relationships of an Entity on HTML page, separately. Eg: If I chose, Account, in the html page, I should be able to see 1:N, N:1 and N:N relationships of Account Entity.

I have tried below, queries and I feel, these are not helping me correctly, Please suggest me a workaround for this to achieve.

https://<CRMORGNAME>/api/data/v8.2/RelationshipDefinitions/Microsoft.Dynamics.CRM.ManyToOneRelationshipMetadata?$select=Entity1LogicalName,SchemaName&$filter=Entity1LogicalName eq 'account'

https://<CRMORGNAME>/api/data/v8.2/RelationshipDefinitions?$select=RelationshipType,SchemaName
Share Improve this question edited Jul 10, 2017 at 15:43 Arun Vinoth PrecogTechnologies 22.8k17 gold badges62 silver badges177 bronze badges asked Jul 10, 2017 at 10:56 Sai KrishnaSai Krishna 2173 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

You can do it the following way:

One to many:

https://contoso.crm.dynamics./api/data/v8.2/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/OneToManyRelationships?$select=SchemaName,RelationshipType

Many to one:

https://contoso.crm.dynamics./api/data/v8.2/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/ManyToOneRelationships?$select=SchemaName,RelationshipType

Many to many:

https://contoso.crm.dynamics./api/data/v8.2/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/ManyToManyRelationships?$select=SchemaName,RelationshipType

Of course you should first get the proper EntityDefinition id (the '70816501-edb9-4740-a16c-6a5efbc05d84' is for account in this case)

https://contoso.crm.dynamics./api/data/v8.2/EntityDefinitions?$select=SchemaName,LogicalName,MetadataId&$filter=LogicalName eq 'account'
发布评论

评论列表(0)

  1. 暂无评论