Open shidcordero opened 4 years ago
DealHubSpot deal = null; if (position.HubSpotDealId.HasValue) { deal = hubSpotApi.Deal.GetById<DealHubSpot>(position.HubSpotDealId.Value); } else { deal = new DealHubSpot(); deal.Associations.AssociatedCompany = new long[] { position.Employer.HubSpotCompanyId.Value }; } deal.Name = $"{position.Employer.Name} - {position.PositionType.Name} - {position.ExperienceLevel.Name}"; deal.DealType = position.PositionType.Name; deal.ExperienceLevel = position.ExperienceLevel.Name; deal.Location = position.Location.Name; deal.DealStatus = position.PositionStatus.Name; deal.Associations.AssociatedContacts = position.PositionCandidates .Where(x => x.Candidate.User.HubSpotContactId.HasValue) .Select(x => x.Candidate.User.HubSpotContactId.Value) .ToArray(); if (position.HubSpotDealId.HasValue) { hubSpotApi.Deal.Update(deal); } else { deal = hubSpotApi.Deal.Create(deal); }
The code above works when the Create method is called, but when using Update to update the AssociatedContacts, it won't work. There's no error thrown so I don't know what workaround to implement.
Create
The code above works when the
Create
method is called, but when using Update to update the AssociatedContacts, it won't work. There's no error thrown so I don't know what workaround to implement.