This illustration shows how to programmatically determine if an entity is eligible to participate in a relationship typ in Microsoft Dynamics CRM 2011 in code using VB.NET.
There are three different SDK web service messages highlighted in this post. They are:
There are three different SDK web service messages highlighted in this post. They are:
- GetValidManyToManyRequest: Get list of entities that can participate in many to many relationships
- GetValidReferencedEntitiesRequest: Get list of entities that can particaipate in one to many relationships as the "many" entity
- GetValidReferencingEntitiesRequest: Get list of entities that can particaipate in one to many relationships as the "one" entity
Ok, here is what the code looks like!
Here's the VB.NET Code:
Dim req As New GetValidManyToManyRequest()
Dim resp As GetValidManyToManyResponse = DirectCast(slos.Execute(req), GetValidManyToManyResponse)
'Get list of entities that can particaipate in one to many relationships as the "many" entity
Dim req2 As New GetValidReferencedEntitiesRequest()
Dim resp2 As GetValidReferencedEntitiesResponse = DirectCast(slos.Execute(req2), GetValidReferencedEntitiesResponse)
'Get list of entities that can particaipate in one to many relationships as the "one" entity
Dim req3 As New GetValidReferencingEntitiesRequest()
Dim resp3 As GetValidReferencingEntitiesResponse = DirectCast(slos.Execute(req3), GetValidReferencingEntitiesResponse)
'now you can get the entitie names this way for each response by examining the response.entitynames property
Thats all there is to it!
I hope this helps!
No comments:
Post a Comment