Posts

Showing posts with the label Entity Relationship

make relationship in Microsoft CRM SDK

If you want to make 1 to N relation between two entities in CRM. You have couple ways.I would like to share two of them. First of all; You can make relation after creating new record .                         CustomEntityInCRM1 referrerEntity = ...//retrieve data;                         CustomEntityInCRM2 referencedEntity = ...//retrieve data;                         Relationship rs = new Relationship(" ");                         EntityCollection relatedEntities = new EntityCollection                         {                             EntityName = referencedEntity.LogicalName,                             Entities = {                                 referencedEntity                             }                         };                         referrerEntity.RelatedEntities.Add(rs, referencedEntity);                         _serviceProxy.Update(referrerEntity); or you can retrieve two of them and make connection (prevent 'The collection is re