Zoho Books - Create Sales Order
@sergio
code:
data:privatelast updated:3 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
nodejs
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
}
7
this.lineitems = JSON.parse(`[
        {
            "item_id": "2392161000000075001"
        }
    ]`);
steps.
zoho_books_create_salesorder
Creates a sales order.
auth
(auths.zoho_books)
params
Organization id

In Zoho Books, your business is termed as an organization. If you have multiple businesses, you simply set each of those up as an individual organization. Each organization is an independent Zoho Books Organization with it’s own organization ID, base currency, time zone, language, contacts, reports, etc.

The parameter organization_id should be sent in with every API request to identify the organization.

The organization_id can be obtained from the GET /organizations API’s JSON response. Alternatively, it can be obtained from the Manage Organizations page in the admin console.

 
string ·params.organization_id
Customer id

ID of the customer to whom the sales order has to be created.

 
string ·params.customer_id
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
}
70
//See the API docs: https://www.zoho.com/books/api/v3/#Sales-Order_Create_a_sales_order

if (!params.organization_id || !params.customer_id || !params.line_items) {
  throw new Error("Must provide organization_id, customer_id, and line_items parameters.");
}

return await require("@pipedreamhq/platform").axios(this, {
  method: "post",
  url: `https://books.${auths.zoho_books.base_api_uri}/api/v3/salesorders?organization_id=${params.organization_id}`,
  headers: {
    Authorization: `Zoho-oauthtoken ${auths.zoho_books.oauth_access_token}`,
  },
  data:{
    customer_id: params.customer_id,
    contact_persons: params.contact_persons,
    date: params.date,
    shipment_date: params.shipment_date,
    custom_fields: params.custom_fields,
    place_of_supply: params.place_of_supply,
    salesperson_id: params.salesperson_id,
    merchant_id: params.merchant_id,
    gst_treatment: params.gst_treatment,
    gst_no: params.gst_no,
    is_inclusive_tax: params.is_inclusive_tax,
    line_items: params.line_items,
    notes: params.notes,
    terms: params.terms,
    billing_address_id: params.billing_address_id,
    shipping_address_id: params.shipping_address_id,
    crm_owner_id: params.crm_owner_id,
    crm_custom_reference_id: params.crm_custom_reference_id,
    vat_treatment: params.vat_treatment,
    tax_treatment: params.tax_treatment,
    salesorder_number: params.salesorder_number,
    reference_number: params.reference_number,
    is_update_customer: params.is_update_customer,
    discount: params.discount,
    exchange_rate: params.exchange_rate,
    salesperson_name: params.salesperson_name,
    notes_default: params.notes_default,
    terms_default: params.terms_default,
    tax_id: params.tax_id,
    tax_authority_id: params.tax_authority_id,
    tax_exemption_id: params.tax_exemption_id,
    tax_authority_name: params.tax_authority_name,
    tax_exemption_code: params.tax_exemption_code,
    avatax_exempt_no: params.avatax_exempt_no,
    avatax_use_code: params.avatax_use_code,
    shipping_charge: params.shipping_charge,
    adjustment: params.adjustment,
    delivery_method: params.delivery_method,
    estimate_id: params.estimate_id,
    is_discount_before_tax: params.is_discount_before_tax,
    discount_type: params.discount_type,
    adjustment_description: params.adjustment_description,
    pricebook_id: params.pricebook_id,
    template_id: params.template_id,
    documents: params.documents,
    zcrm_potential_id: params.zcrm_potential_id,
    zcrm_potential_name: params.zcrm_potential_name    
  },
  params: {
    ignore_auto_number_generation: params.ignore_auto_number_generation,
    can_send_in_mail: params.can_send_in_mail,
    totalFiles: params.totalFiles,
    doc: params.doc
  }
})