# List Cases — Salesforce

> List Salesforce support cases, newest first. Use this to find a case and its ID. Every filter is optional and they combine with AND - call with no filters to see the most recent cases. For example, Status New with Limit 10 returns the ten…

- Key: `salesforce_rest_api-list-cases`
- Type: Action (Read-only)
- Version: 0.0.4
- App: Salesforce (`salesforce_rest_api`) — https://pipedream.com/apps/salesforce-rest-api.md
- This page (HTML): https://pipedream.com/apps/salesforce-rest-api/actions/list-cases
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/salesforce_rest_api/actions/list-cases/list-cases.mjs

## Description

List Salesforce support cases, newest first. Use this to find a case and its ID. Every filter is optional and they combine with AND - call with no filters to see the most recent cases. For example, `Status` `New` with `Limit` `10` returns the ten newest open cases. Status values are org-configurable. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `caseNumber` | `string` | No | Return only the case with this case number, e.g. 00001024. This is the human-readable number shown in the Salesforce UI, not the record ID. |
| `subject` | `string` | No | Return only cases whose subject contains this text (case-insensitive), e.g. rotor. |
| `status` | `string` | No | Return only cases with this exact status, e.g. New. Org-configurable - use Describe Object on Case to list the valid values. |
| `accountId` | `string` | No | Return only cases on this account (15- or 18-character Salesforce ID, e.g. 001P500000dGpZLIA0). Use Find Records on Account to look one up. |
| `isClosed` | `boolean` | No | Set to true to return only closed cases, or false for only open ones. Omit to return both. |
| `createdAfter` | `string` | No | Return only cases created on or after this moment. ISO 8601 date (2026-08-01) or date-time (2026-08-01T00:00:00Z). |
| `fields` | `string[]` | No | The Case fields to return. Defaults to a compact set: Id, CaseNumber, Subject, Status, Priority, Origin, IsClosed, AccountId, ContactId, OwnerId, CreatedDate, LastModifiedDate. Id is always returned. Options are loaded from the connected account. |
| `limit` | `integer` | No | The maximum number of cases to return. Valid values are integers from 1 through 1000. Default is 100. |

## 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-list-cases",
  arguments: {
    caseNumber: "Case Number",
    subject: "Subject Contains",
  },
})
```

**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-list-cases",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    salesforce_rest_api: { authProvisionId: "apn_xxxxxxx" },
    caseNumber: "Case Number",
    subject: "Subject Contains",
  },
})

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-list-cases",
    "configured_props": {
      "salesforce_rest_api": { "authProvisionId": "apn_xxxxxxx" },
      "caseNumber": "Case Number",
      "subject": "Subject Contains"
    }
  }'
```

---

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