/// <summary> /// Associates the <see cref="Contact"/> record to the <see cref="EmailSend"/> record. /// </summary> /// <param name="context"></param> protected override void ExecuteActivity(CodeActivityContext context) { try { EntityReference emailSendReference = EmailSend.Get(context); EntityReference contactReference = Contact.Get(context); Service.Associate("cdi_emailsend", emailSendReference.Id, new Relationship("cdi_emailsend_contact"), new EntityReferenceCollection(new[] { contactReference })); } catch (Exception e) { TracingService.Trace("Couldn't associate contact to email: {0}", e.Message); throw; } }