Skip to content

PM-6363: Import project details from a Salesforce opportunity - #2321

Merged
jmgasper merged 1 commit into
devfrom
PM-6363
Sep 17, 2026
Merged

jmgasper merged 1 commit into
devfrom
PM-6363

Conversation

@jmgasper

@jmgasper jmgasper commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Implements the UI half of PM-6363. Depends on topcoder-platform/projects-api-v6#45, which adds the GET /v6/projects/salesforce/opportunities/:id endpoint this branch calls.

1. Work app — auto-populate project details

The Edit Project Details form gains a Salesforce Opportunity ID field. Once a valid id is entered, the opportunity is looked up and the existing fields are filled in:

Work App field Salesforce Opportunity field
Customer Subcontracting End Customer
SMU Reporting SMU
Deal Close Date Close Date

A clickable View in Salesforce link appears next to the field once the id resolves, opening the record in a new tab.

Details worth noting:

  • The lookup is debounced and aborts obsolete requests; an incomplete id shows the inline validation message and never reaches the API.
  • Only fields Salesforce actually supplies are written, so a blank Subcontracting End Customer does not wipe a Customer that was entered by hand.
  • Population is a response to typing. Reopening a project that already has an opportunity linked shows the link but does not overwrite details edited afterwards.
  • Failures (403, 404, Salesforce unavailable) show a sanitized message under the field and leave the form untouched.

The field is limited to the project editor; the showcase modal keeps the fields it had.

2. Sales app — opportunity description popup

Report cells whose value is a Salesforce opportunity id render the opportunity name as a button. Clicking it opens a popup showing the description first, then Customer, SMU, Close Date and Stage when Salesforce provides them, plus a link to the record. It closes with the Close button or the X icon.

Detecting the opportunity from the cell value means no change to reports-api-v6: the Salesforce Analytics API already returns the record id as the value of the Opportunity Name cell, with the display name as its label. Cells without one stay plain text.

3. SMU rename

SMU_VALUES becomes APME, EURP, AMR1, AMR2 (plus Others) — the exact Reporting_SMU__c codes in the dev Salesforce org, so an imported opportunity matches the dropdown. The ticket writes "AMPE" and "AM2"; those are treated as typos of APME and AMR2, confirmed with the reporter.

Projects saved with the old labels (APMEA, Europe, Americas1, Americas2) are mapped to the current option when the editor, the showcase form and the showcase details view load them, so nothing renders blank and no data migration is needed.

Testing

  • 6 new tests across ProjectEditorForm and SalesPage covering population, the Salesforce link, the incomplete-id path, opening and closing the popup, a failed lookup, and cells without an opportunity id.
  • src/apps/work + src/apps/sales: 822 passed, with the same 10 suite / 3 test pre-existing failures as origin/dev (unrelated specs: PaymentFormModal, ChallengePrizesField, ProjectsListPage, Engagement*).
  • tsc --noEmit clean, eslint clean, LOGICAL_ENV=dev craco build succeeds.

🤖 Generated with Claude Code

Work app — Edit Project Details:
- Adds a Salesforce Opportunity ID field. A valid id is looked up through
  projects-api-v6 and populates Customer (Subcontracting End Customer), SMU
  (Reporting SMU) and Deal Close Date, leaving fields Salesforce does not
  supply untouched. Reopening a linked project shows the link without
  overwriting details that were edited by hand afterwards.
- Shows a "View in Salesforce" link once the opportunity resolves, opening the
  record in a new tab.

Sales app:
- Report cells carrying a Salesforce opportunity id render the opportunity name
  as a button that opens a popup showing the description first, then customer,
  SMU, close date and stage, plus a link to the record. The popup closes with
  its Close button or the X icon.

SMU options are renamed to the Salesforce codes (APME, EURP, AMR1, AMR2) so the
imported Reporting SMU matches the dropdown. Projects saved with the previous
labels render and save as the current option.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jmgasper
jmgasper requested a review from kkartunov as a code owner September 17, 2026 20:10
@jmgasper
jmgasper merged commit 6aea17e into dev Sep 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant