# Update Accounts (Batch) — Salesforce

> Update many Salesforce accounts in one job using Bulk API 2.0. Use this instead of Update Account when updating more than roughly 200 records - it is asynchronous and returns a job ID, not the updated records. Every row must include the…

- Key: `salesforce_rest_api-update-accounts-batch`
- Type: Action (Write)
- Version: 0.0.8
- App: Salesforce (`salesforce_rest_api`) — https://pipedream.com/apps/salesforce-rest-api.md
- This page (HTML): https://pipedream.com/apps/salesforce-rest-api/actions/update-accounts-batch
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/salesforce_rest_api/actions/update-accounts-batch/update-accounts-batch.mjs

## Description

Update many Salesforce accounts in one job using Bulk API 2.0. Use this instead of **Update Account** when updating more than roughly 200 records - it is asynchronous and returns a job ID, not the updated records. Every row must include the record `Id` of the account to update. Input is a CSV file - supply a path under `/tmp` or a URL to download it from, with a header row of Salesforce field API names. Poll the job in Salesforce to confirm completion; a successful response means the job was accepted, not that every row loaded. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_understanding_bulk2_ingest.htm)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `csvFilePath` | `string` | Yes | The path to the CSV file to process. Provide a path to a file in the /tmp directory (for example, /tmp/data.csv). If a URL is provided, the file will be downloaded to the /tmp directory. See the documentation |
| `syncDir` | `dir` | Yes | SyncDir |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "salesforce_rest_api",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "salesforce_rest_api-update-accounts-batch",
  arguments: {
    csvFilePath: "CSV File Path Or URL",
    syncDir: "SyncDir",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "salesforce_rest_api-update-accounts-batch",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    salesforce_rest_api: { authProvisionId: "apn_xxxxxxx" },
    csvFilePath: "CSV File Path Or URL",
    syncDir: "SyncDir",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "salesforce_rest_api-update-accounts-batch",
    "configured_props": {
      "salesforce_rest_api": { "authProvisionId": "apn_xxxxxxx" },
      "csvFilePath": "CSV File Path Or URL",
      "syncDir": "SyncDir"
    }
  }'
```

---

- App: https://pipedream.com/apps/salesforce-rest-api.md · All apps: https://pipedream.com/apps
