# Update Account — Microsoft Dynamics 365 Sales

> Update an existing account; only the fields you supply are sent. See the account entity reference for the full list of updatable fields. See the documentation

- Key: `microsoft_dynamics_365_sales-update-account`
- Type: Action (Write)
- Version: 0.0.2
- App: Microsoft Dynamics 365 Sales (`microsoft_dynamics_365_sales`) — https://pipedream.com/apps/microsoft-dynamics-365-sales.md
- This page (HTML): https://pipedream.com/apps/microsoft-dynamics-365-sales/actions/update-account
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/microsoft_dynamics_365_sales/actions/update-account/update-account.mjs

## Description

Update an existing account; only the fields you supply are sent. See the [account entity reference](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/account) for the full list of updatable fields. [See the documentation](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/update-delete-entities-using-web-api)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `accountId` | `string` | Yes | Identifier of an account Options are loaded from the connected account. |
| `name` | `string` | No | Company or business name of the account |
| `telephone1` | `string` | No | Main phone number for the account |
| `emailaddress1` | `string` | No | Primary email address for the account |
| `websiteurl` | `string` | No | Website URL for the account (for example https://www.example.com) |
| `fax` | `string` | No | Fax number for the account |
| `description` | `string` | No | Additional information describing the account |
| `numberofemployees` | `integer` | No | Number of employees at the account |
| `revenue` | `string` | No | Annual revenue for the account, in the base currency (numeric, for example 1500000) |
| `address1Line1` | `string` | No | First line of the primary address |
| `address1City` | `string` | No | City of the primary address |
| `address1Stateorprovince` | `string` | No | State or province of the primary address |
| `address1Postalcode` | `string` | No | ZIP or postal code of the primary address |
| `address1Country` | `string` | No | Country or region of the primary address |
| `primaryContactId` | `string` | No | Contact to set as the primary contact for the account. Provide the contact's GUID (for example 00000000-0000-0000-0000-000000000001) — the contactid value copied from the contact record in Dynamics or returned by the Find Contact action. Options are loaded from the connected account. |
| `additionalProperties` | `object` | No | Any other account attributes to update, keyed by their Dynamics logical name (for example { "industrycode": 1 }). Values are sent as-is. Use attribute@odata.bind keys to set lookups. See the account entity reference |

## 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": "microsoft_dynamics_365_sales",
      },
    },
  },
)

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: "microsoft_dynamics_365_sales-update-account",
  arguments: {
    accountId: "Account ID",
    name: "Account Name",
  },
})
```

**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: "microsoft_dynamics_365_sales-update-account",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    microsoft_dynamics_365_sales: { authProvisionId: "apn_xxxxxxx" },
    accountId: "Account ID",
    name: "Account Name",
  },
})

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": "microsoft_dynamics_365_sales-update-account",
    "configured_props": {
      "microsoft_dynamics_365_sales": { "authProvisionId": "apn_xxxxxxx" },
      "accountId": "Account ID",
      "name": "Account Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/microsoft-dynamics-365-sales.md · All apps: https://pipedream.com/apps
