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

I have a requirement to fetch and show all the available Relationships of an Entity on HTML page, separ

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'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742273817a4413205.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信