Salesforce · Arazzo Workflow

Salesforce Create Record

Version 1.0.0

Create an SObject record then retrieve it by its newly assigned record id.

1 workflow 1 source API 1 provider
View Spec View on GitHub AIAnalyticsCloudCommerceCRMCustomer ServiceEnterpriseMarketingPlatformSalesArazzoWorkflows

Provider

salesforce

Workflows

create-record
Create a single Salesforce SObject record and retrieve it by id.
Creates a new record of the given SObject type from the supplied field map, then fetches the newly created record by id to verify the persisted state.
2 steps inputs: fields, sobjectType outputs: record, recordId
1
createRecord
createRecord
Create a new record of the requested SObject type using the supplied field values. Returns the id of the newly created record.
2
getRecord
getRecord
Retrieve the record just created, by SObject type and id, to confirm the write succeeded and inspect the persisted field values.

Source API Descriptions

Arazzo Workflow Specification

salesforce-create-record-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Salesforce Create Record
  summary: Create an SObject record then retrieve it by its newly assigned record id.
  description: >-
    A foundational Salesforce data pattern. The workflow creates a new record of
    the supplied SObject type using the field values provided, captures the
    18-character record id returned by the create call, and then reads that
    record back so callers can confirm the write and inspect the persisted
    field values. Every step spells out its request inline so the flow can be
    read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: salesforceRestApi
  url: ../openapi/salesforce-rest-api-openapi.yml
  type: openapi
workflows:
- workflowId: create-record
  summary: Create a single Salesforce SObject record and retrieve it by id.
  description: >-
    Creates a new record of the given SObject type from the supplied field map,
    then fetches the newly created record by id to verify the persisted state.
  inputs:
    type: object
    required:
    - sobjectType
    - fields
    properties:
      sobjectType:
        type: string
        description: >-
          The API name of the Salesforce SObject type (e.g. Account, Contact,
          MyCustomObject__c).
      fields:
        type: object
        description: >-
          Map of field API name to value for the new record (e.g.
          {"LastName": "Smith", "Email": "[email protected]"}).
  steps:
  - stepId: createRecord
    description: >-
      Create a new record of the requested SObject type using the supplied
      field values. Returns the id of the newly created record.
    operationId: createRecord
    parameters:
    - name: sobjectType
      in: path
      value: $inputs.sobjectType
    requestBody:
      contentType: application/json
      payload: $inputs.fields
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      recordId: $response.body#/id
      success: $response.body#/success
  - stepId: getRecord
    description: >-
      Retrieve the record just created, by SObject type and id, to confirm the
      write succeeded and inspect the persisted field values.
    operationId: getRecord
    parameters:
    - name: sobjectType
      in: path
      value: $inputs.sobjectType
    - name: id
      in: path
      value: $steps.createRecord.outputs.recordId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      record: $response.body
  outputs:
    recordId: $steps.createRecord.outputs.recordId
    record: $steps.getRecord.outputs.record