Associate Contact with Existing Deal
I can create a new deal with a contact, that works great but when attempting to use the deal update and try to add a contact I am missing something.
code snippet: var deal=api.Deal.GetById<DealHubSpotModel>(dealId); var contact = api.Contact.GetByEmail<ContactHubSpotModel>(contact.Email); deal.Associations.AssociatedContacts=new []{contact.Id.Value}; api.Deal.Update(deal); This succeeds but when I check hubspot there is no associated contact
Hi! What version of HubSpot.NET are you using?
0.6.17
Hi @TimWhitbeck, I think that I will try to add an easier way to associate the contacts with the deal. Possibl add a dedicated method to the Deal. Thank you again for bringing this up!
I coded it like this and it works.
DealHubSpotModel deal = HsAPI.Deal.Create(new DealHubSpotModel() { Associations = { AssociatedContacts = new[] { lHsVid } }, /* lHsVid is Contact Vid */ Name = "Super Product" }); lDealid = (long)deal.Id; // Get back deal.id