Conversation
…ions Adds a read-only Salesforce opportunity endpoint that the Work app uses to populate project details and the Sales app uses for its opportunity popup: - GET /v6/projects/salesforce/opportunities/:opportunityId returns the opportunity name, description, Subcontracting End Customer, Reporting SMU, Close Date, stage and a link to the record. - SalesforceClient runs SOQL over the OAuth client-credentials flow, mirroring the Reports API client: trusted-origin allow-list, bounded retries, in-memory token reuse and a single renewal on 401. Record ids are validated against a strict pattern before they reach the query. - Access requires a manager-tier role (Work) or a talent-manager role (Sales). Renames the SMU options to the Salesforce Reporting SMU codes (APME, EURP, AMR1, AMR2) so an imported opportunity maps onto a project without translation. Projects saved with the previous labels are upgraded in place on the next write, and an unrecognized Reporting SMU is surfaced as Others plus the raw value. Project.details.salesforceOpportunityId is validated alongside the other shared metadata. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the projects-api-v6 half of PM-6363.
What this adds
GET /v6/projects/salesforce/opportunities/:opportunityId— a read-only lookup returning the opportunity name, description, Subcontracting End Customer, Reporting SMU, Close Date, stage and a link to the record. The Work app uses it to populate project details from an opportunity; the Sales app uses it for the opportunity description popup.{ "id": "006UN00000XamntYAB", "name": "EMEA - Amazon Web Services - PS BFSI", "description": "Next AWS MVP/POC (Shabam Sponsor)", "customer": "Novartis Pharmaceuticals", "smu": "AMR1", "reportingSmu": "AMR1", "closeDate": "2026-07-31", "stageName": "Prospecting", "url": "https://topcoder.my.salesforce.com/006UN00000XamntYAB" }SalesforceClientis modelled on thereports-api-v6Salesforce client, as requested:*.my.salesforce.com,login/test.salesforce.com) checked before credentials or tokens are sent anywhere.^006[a-zA-Z0-9]{12}([a-zA-Z0-9]{3})?$before they reach the SOQL literal, so the id cannot terminate the quoted string.Access requires a manager-tier role (Work app editors) or a talent-manager role (Sales app viewers).
SMU rename
The ticket asks to rename the SMU options "to follow the same naming pattern in all places". The dev Salesforce org emits
APME,EURP,AMR1,AMR2(andINTERNAL) forOpportunity.Reporting_SMU__c, so the options now use those exact codes and an imported opportunity maps onto a project with no translation. The ticket text lists "AMPE" and "AM2"; those are treated as typos ofAPMEandAMR2, confirmed with the reporter.Backward compatibility: projects saved as
APMEA/Europe/Americas1/Americas2are accepted and upgraded in place on the next write, so no data migration is needed and existing showcase saves keep working. An unrecognized Reporting SMU (for exampleINTERNAL) is surfaced asOtherswith the raw value insmuOtherrather than being dropped.Project.details.salesforceOpportunityIdis validated alongside the other shared metadata.Configuration
Four new optional env vars, documented in the README:
SALESFORCE_API_CONSUMER_KEYSALESFORCE_API_CONSUMER_SECRETSALESFORCE_LOGIN_URLhttps://topcoder.my.salesforce.comSALESFORCE_REST_API_VERSION65.0These are separate from the existing JWT-bearer
SALESFORCE_CLIENT_*variables used byBillingAccountService; both integrations coexist. Without them the endpoint returns 503 and nothing else changes.Testing
origin/dev(JWT and metadata specs that need a database).Reporting_SMU__c = AMR1, one withINTERNAL(mapped to Others), and an unknown id (404).tsc --noEmitandeslintclean.🤖 Generated with Claude Code