arazzo: 1.0.1 info: title: Salesforce Sales Cloud Opportunity With Contact Role summary: Open an Opportunity, then attach a Contact to it as an OpportunityContactRole. description: >- Models the deal-stakeholder pattern over the SObject Rows resource. The workflow opens an Opportunity against an existing Account, then creates an OpportunityContactRole junction record linking a Contact to that Opportunity with a named role and primary flag. Every step inlines its request and the OAuth bearer Authorization header. version: 1.0.0 sourceDescriptions: - name: restApi url: ../openapi/salesforce-sales-cloud-rest-api-openapi.yml type: openapi workflows: - workflowId: opportunity-with-contact-role summary: Create an Opportunity and attach a Contact as a contact role. description: >- Creates an Opportunity tied to an Account, then creates an OpportunityContactRole record referencing the new Opportunity and the supplied Contact. inputs: type: object required: - accessToken - accountId - contactId - opportunityName - closeDate - stageName - role properties: accessToken: type: string description: OAuth 2.0 access token used as the Bearer credential. accountId: type: string description: Id of the existing Account the Opportunity belongs to. contactId: type: string description: Id of the Contact to attach as a contact role. opportunityName: type: string description: Name of the Opportunity to create. closeDate: type: string description: Close date for the Opportunity (YYYY-MM-DD). stageName: type: string description: Stage name for the Opportunity. role: type: string description: The contact role label (e.g. "Decision Maker"). isPrimary: type: boolean description: Whether this contact is the primary contact on the Opportunity. default: true steps: - stepId: createOpportunity description: Open the Opportunity against the supplied Account. operationId: createSObjectRecord parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: sObjectName in: path value: Opportunity requestBody: contentType: application/json payload: Name: $inputs.opportunityName AccountId: $inputs.accountId CloseDate: $inputs.closeDate StageName: $inputs.stageName successCriteria: - condition: $statusCode == 201 outputs: opportunityId: $response.body#/id - stepId: addContactRole description: Link the Contact to the new Opportunity as a contact role. operationId: createSObjectRecord parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: sObjectName in: path value: OpportunityContactRole requestBody: contentType: application/json payload: OpportunityId: $steps.createOpportunity.outputs.opportunityId ContactId: $inputs.contactId Role: $inputs.role IsPrimary: $inputs.isPrimary successCriteria: - condition: $statusCode == 201 outputs: contactRoleId: $response.body#/id outputs: opportunityId: $steps.createOpportunity.outputs.opportunityId contactRoleId: $steps.addContactRole.outputs.contactRoleId