Associate multiple records

As a variant to a recent post I did, here’s another method to associate records, difference is that this will associate multiple number of records in a single transaction

///
/// Associate multiple records in a single transaction
/// 
public void Associate_Multiple_Records(EntityReference Main_Record, string Relationship_Name, EntityReferenceCollection RecordsToBeAssociated, IOrganizationService Service)
{
    Service.Associate(Main_Record.LogicalName,
                      Main_Record.Id,
                      new Relationship(Relationship_Name),
                      RecordsToBeAssociated);
}

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s