# Create Sales Order — Zoho Books

> Creates a sales order. See the documentation

- Key: `zoho_books-create-salesorder`
- Type: Action (Write)
- Version: 0.3.1
- App: Zoho Books (`zoho_books`) — https://pipedream.com/apps/zoho-books.md
- This page (HTML): https://pipedream.com/apps/zoho-books/actions/create-salesorder
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/zoho_books/actions/create-salesorder/create-salesorder.mjs

## Description

Creates a sales order. [See the documentation](https://www.zoho.com/books/api/v3/sales-order/#create-a-sales-order)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `customerId` | `string` | Yes | ID of the customer to whom the sales order has to be created. Options are loaded from the connected account. |
| `contactPersons` | `string[]` | No | A list of contact person(s) for whom sales order has to be sent. Options are loaded from the connected account. |
| `date` | `string` | No | The date, the sales order is created. |
| `shipmentDate` | `string` | No | Shipping date of sales order. |
| `customFields` | `string[]` | No | A list of custom field objects for a sales order. Example: {"customfield_id": "1352827000000156060", "value": "value" } See the documentation for further details. |
| `placeOfSupply` | `string` | No | Place where the goods/services are supplied to. (If not given, place of contact given for the contact will be taken). |
| `salespersonId` | `string` | No | ID of the salesperson. |
| `merchantId` | `string` | No | ID of the merchant. |
| `gstTreatment` | `string` | No | Choose whether the contact is GST registered/unregistered/consumer/overseas. |
| `gstNo` | `string` | No | 15 digit GST identification number of the customer. |
| `isInclusiveTax` | `boolean` | No | Used to specify whether the line item rates are inclusive or exclusive of tax. |
| `lineItems` | `string[]` | Yes | A list of line items objects of a sales order. Example: {"item_order": "1352827000000156060", "name": "name", "description": "description", "quantity": "1" } See the documentation for further details. |
| `notes` | `string` | No | Notes for this Sales Order. |
| `terms` | `string` | No | The terms added below expressing gratitude or for conveying some information. |
| `billingAddressId` | `string` | No | ID of the Billing Address |
| `shippingAddressId` | `string` | No | ID of the Shipping Address. |
| `crmOwnerId` | `string` | No | CRM Owner Id |
| `crmCustomReferenceId` | `string` | No | CRM Custom Reference Id |
| `vatTreatment` | `string` | No | Enter vat treatment. |
| `taxTreatment` | `string` | No | VAT treatment for the invoice. |
| `salesorderNumber` | `string` | No | Mandatory if auto number generation is disabled. |
| `referenceNumber` | `string` | No | For Customer Only : If a contact is assigned to any particular user, that user can manage transactions for the contact |
| `isUpdateCustomer` | `boolean` | No | Boolean to update billing address of customer. |
| `discount` | `string` | No | Discount applied to the sales order. It can be either in % or in amount. e.g. 12.5% or 190. |
| `exchangeRate` | `string` | No | Exchange rate of the currency. |
| `salespersonName` | `string` | No | Name of the sales person. |
| `notesDefault` | `string` | No | Default Notes for the Sales Order |
| `termsDefault` | `string` | No | Default Terms of the Sales Order. |
| `taxId` | `string` | No | ID of the tax. Options are loaded from the connected account. |
| `taxAuthorityId` | `string` | No | ID of the tax authority. Tax authority depends on the location of the customer. For example, if the customer is located in NY, then the tax authority is NY tax authority. Options are loaded from the connected account. |
| `taxExemptionId` | `string` | No | ID of the tax exemption. Options are loaded from the connected account. |
| `taxAuthorityName` | `string` | No | Tax Authority's name. |
| `taxExemptionCode` | `string` | No | Code of Tax Exemption that is applied. |
| `avataxExemptNo` | `string` | No | ID of the tax exemption. Options are loaded from the connected account. |
| `avataxUseCode` | `string` | No | Used to group like customers for exemption purposes. It is a custom value that links customers to a tax rule. |
| `shippingCharge` | `string` | No | Shipping charges applied to the invoice. |
| `adjustment` | `string` | No | Adjustment |
| `adjustmentDescription` | `string` | No | Adjustment Description |
| `deliveryMethod` | `string` | No | Delivery Method |
| `estimateId` | `string` | No | ID of the estimate associated with the Sales Order. |
| `isDiscountBeforeTax` | `boolean` | No | Used to specify how the discount has to applied. Either before or after the calculation of tax. |
| `discountType` | `string` | No | How the discount is specified. Allowed values are entity_level or item_level. |
| `pricebookId` | `string` | No | Pricebook Id |
| `templateId` | `string` | No | ID of the PDF template. |
| `documents` | `string[]` | No | A list of documents. |
| `zcrmPotentialId` | `string` | No | ZCRM Potential Id |
| `zcrmPotentialName` | `string` | No | ZCRM Potential Name |
| `ignoreAutoNumberGeneration` | `boolean` | No | Ignore auto sales order number generation for this sales order. This mandates the sales order number. |
| `canSendInMail` | `string` | No | Can the file be sent in mail. |
| `totalFiles` | `string` | No | Total number of files. |
| `doc` | `string` | No | Document that is to be attached |

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

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: "zoho_books-create-salesorder",
  arguments: {
    customerId: "Customer Id",
    contactPersons: ["Contact Persons"],
  },
})
```

**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: "zoho_books-create-salesorder",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    zoho_books: { authProvisionId: "apn_xxxxxxx" },
    customerId: "Customer Id",
    contactPersons: ["Contact Persons"],
  },
})

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": "zoho_books-create-salesorder",
    "configured_props": {
      "zoho_books": { "authProvisionId": "apn_xxxxxxx" },
      "customerId": "Customer Id",
      "contactPersons": ["Contact Persons"]
    }
  }'
```

---

- App: https://pipedream.com/apps/zoho-books.md · All apps: https://pipedream.com/apps
