HubSpot integration bar shows No deal linked when deal exists on quote

Objective

  • Fix the inspection Integrations → HubSpot accordion so the collapsed summary accurately reflects whether a HubSpot deal is linked.
  • Stop CSRs from seeing “No deal linked” when opening the panel shows a valid deal (name, stage, Deal ID) — especially on quote-converted jobs in brands such as AJF and TLC.

Background

  • On the workorder integrations tab, the HubSpot row header can show “No deal linked” while the expanded body shows deal details (e.g. Inspection Completed, Deal ID 60334164530, deal name AJF - ATK - 1008594063).
  • Reported examples:
  • 1008594063
  • 1008593282
  • 1008594723
  • Root cause in code: the header only checks inspection._hubspotDealId, while GET /hubspot/deal/:inspectionId resolves inspection._hubspotDealId || linkedQuote._hubspotDealId (quote where _finalInspectionId matches the inspection).
  • Common path: deal created on the quote during pending quote sync (upsertHsDeal); inspection sync later updates that deal via the quote’s id (upsertHsDealFromInspection prefers linkedQuote._hubspotDealId) but only writes _hubspotDealId onto the inspection when creating a new deal — not when updating an existing quote-linked deal.
  • HubSpot stage sync may be correct for these jobs; this is a display / data consistency problem, not missing HubSpot completion (see related work on published → completed sync).

Scope

Frontend

  • Accordion header in attik-frontend/src/app/tools/inspections/[id]/components/integrations/HubSpot.tsx (getHubSpotData): rightSideComponent uses only inspection._hubspotDealId for “No deal linked” vs “Deal ID: …”.
  • Expanded body in HubSpotContent loads hubspot/deal/${inspectionId} only when accordion is expanded (isExpanded) — header does not use that API today.
  • Decision needed: Resolve deal id for the header the same way as the backend (inspection + linked quote), or show a lightweight summary from the same endpoint when integrations mount.

Backend

  • Deal lookup: attik-backend/src/routes/hubspot.ts (GET /deal/:inspectionId) — dealId = inspection._hubspotDealId || linkedQuote?._hubspotDealId.
  • Sync: attik-backend/src/util/functions/hubspot/upsertHsDealFromInspection.tsexistingDealId = linkedQuote?._hubspotDealId || inspection._hubspotDealId; inspection _hubspotDealId set on create only.
  • Quote deal creation: attik-backend/src/util/functions/hubspot/upsertHsDeal.ts stores _hubspotDealId on the quote.
  • Decision needed: Whether to backfill inspection._hubspotDealId after successful sync when the deal id came from the linked quote (keeps header and API aligned for other consumers).

Out of scope unless expanded

  • HubSpot deal stage mapping (published → Inspection Completed) — tracked separately.
  • Mold assessment multi-select fuzzy match on HubSpot deals.

References

  • Example: https://www.attik.ai/inspections/1008594063?tab=integrations
  • Frontend: attik-frontend/src/app/tools/inspections/[id]/components/integrations/HubSpot.tsx
  • Backend deal GET: attik-backend/src/routes/hubspot.ts
  • Inspection sync: attik-backend/src/util/functions/hubspot/upsertHsDealFromInspection.ts

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

5 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.