erpnext@1.0.0
- create(doctype, data)
- deleteRecord(doctype, name)
- getCount(doctype, filters)
- getList(doctype, options)
- read(doctype, name)
- update(doctype, name, data)
This adaptor exports the following from common:
Functions
create
create(doctype, data) ⇒ Operation
Create a document in ERPNext. Returns the complete created document with all fields.
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to create (e.g., "Customer", "Sales Order") | 
| data | object | The document data as JSON | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Create a customer record
create('Customer', {
  customer_name: 'Acme Corporation',
  customer_type: 'Company'
});
Example: Create with data from state
create('Sales Order', $.orderData);
Example: Create an item with multiple fields
create('Item', {
  item_code: 'ITEM-001',
  item_name: 'Sample Product',
  item_group: 'Products',
  stock_uom: 'Nos'
});
deleteRecord
deleteRecord(doctype, name) ⇒ Operation
Delete a document from ERPNext
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to delete from (e.g., "Customer", "Sales Order") | 
| name | string | The document name/ID to delete | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Delete a customer
deleteRecord('Customer', 'CUST-00001');
Example: Delete using state data
deleteRecord('Sales Order', $.data.order_id);
Example: Delete a draft document
deleteRecord('Quotation', 'QTN-00001');
getCount
getCount(doctype, filters) ⇒ Operation
Get count of documents matching filters
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to count (e.g., "Customer", "Sales Order") | 
| filters | object | Optional filters to apply (e.g., { status: 'Open' }) | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Count all customers
getCount('Customer');
Example: Count with filters
getCount('Sales Order', { status: 'Open' });
Example: Count from state data
getCount('Item', { item_group: $.data.group_name });
getList
getList(doctype, options) ⇒ Operation
Get a list of documents from ERPNext with filtering, field selection, and pagination
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to query (e.g., "Customer", "Sales Order") | 
| options | ListOptions | Optional query configuration. See Frappe Database API for supported options. | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Get all customers
getList('Customer');
Example: Get customers with filters
getList('Customer', {
  filters: { customer_type: 'Company' },
  fields: ['name', 'customer_name', 'territory']
});
Example: Get with pagination
getList('Sales Order', {
  filters: { status: 'Draft' },
  limit: 50,
  offset: 0,
  orderBy: 'creation desc'
});
Example: Get specific fields only
getList('Item', {
  fields: ['item_code', 'item_name', 'standard_rate'],
  filters: { item_group: 'Products' },
  limit: 100
});
read
read(doctype, name) ⇒ Operation
Read a document from ERPNext by name/ID. Returns the complete document with all fields. Note: For field selection, use getList() with filters instead.
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to read from (e.g., "Customer", "Sales Order") | 
| name | string | The document name/ID to read | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Read a customer by name
read('Customer', 'CUST-00001');
Example: Read from state data
read('Item', $.data.item_code);
Example: Read a sales order
read('Sales Order', $.orderId);
update
update(doctype, name, data) ⇒ Operation
Update a document in ERPNext
| Param | Type | Description | 
|---|---|---|
| doctype | string | The doctype to update (e.g., "Customer", "Sales Order") | 
| name | string | The document name/ID to update | 
| data | object | The fields to update as JSON | 
This operation writes the following keys to state:
| State Key | Description | 
|---|---|
| data | The response body (as JSON) | 
| response | The HTTP response from the ERPNext server (excluding the body) | 
| references | An array of all previous data objects used in the Job | 
Example: Update a customer's details
update('Customer', 'CUST-00001', {
  customer_name: 'Updated Corp Name',
  mobile_no: '+1234567890'
});
Example: Update using state data
update('Sales Order', $.data.order_id, {
  status: 'Confirmed'
});
Example: Update multiple fields
update('Item', 'ITEM-001', {
  item_name: 'Updated Product Name',
  standard_rate: 150.00,
  description: 'Updated description'
});
Interfaces
ListOptions
Options object for list operations
See: Frappe Database API
Properties
| Name | Type | Description | 
|---|---|---|
| filters | object | Filters to apply to the query (e.g., { status: 'Open' }). | 
| fields | Array.<string> | Array of field names to return (e.g., ['name', 'status']). | 
| limit | number | Maximum number of records to return. Defaults to 1000. | 
| offset | number | Number of records to skip. Defaults to 0. | 
| orderBy | string | Field to sort by with direction (e.g., 'creation desc'). |