Random Musings

June 10, 2009

Remove the linkage between two entities in many to many relationships

Filed under: Dynamics CRM — haditeo @ 6:05 pm
Tags: ,

To disassociate the relationship between two entities which are linked via many to many relationship, these code snippet can be used :

                DisassociateEntitiesRequest disassociateRequest = new DisassociateEntitiesRequest();
                disassociateRequest.Moniker1 = new Moniker();
                disassociateRequest.Moniker1.Id = entityId;
                disassociateRequest.Moniker1.Name = entityName;

                disassociateRequest.Moniker2 = new Moniker();
                disassociateRequest.Moniker2.Id = entityId2;
                disassociateRequest.Moniker2.Name = entityName2;
                disassociateRequest.RelationshipName = relationshipName;

                DisassociateEntitiesResponse associateResponse = (DisassociateEntitiesResponse)crmService.Execute(disassociateRequest);

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: