Search Documents
erpnext.search_documents
ActionCRM & salesconnection required
Calls the ERPNext API with the connection's credentials.
Find documents whose chosen fields contain a search term, as a case-insensitive OR of 'like' matches.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- API key
- Providers
- ERPNext
- Secret shape
- {"api_key": "…", "api_secret": "…"}
- Config it needs
- base_url, doctype
- Resolved by
- config.connection_id, else node.connection_id
Configuration
8 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
doctype The DocType to act on, spelled as ERPNext spells it (e.g. 'Sales Order'). Overrides the default DocType on the connection. | string | No | — | — | Customer |
term The text to look for. It is wrapped in % wildcards unless you write your own. | string | Yes | — | — | acme |
search_fields Which fields the term must match, e.g. ["customer_name", "name"]. Defaults to the document name. | array | No | — | array of string | — |
fields Which fields to return, e.g. ["name", "customer_name", "status"]. Leave empty for the name only, which is what ERPNext returns by default. | array | No | — | array of string | — |
filters Frappe filters as a list of triples, e.g. [["status", "=", "Open"], ["grand_total", ">", 1000]]. Combined with AND. | array | No | — | — | — |
order_by Sort clause in Frappe's form: a field name followed by asc or desc. | string | No | — | — | modified desc |
limit How many documents to return. 0 asks ERPNext for every match, which on a large DocType can be slow. ERPNext defaults to 20 when this is empty. | number | No | 20 | 0–100000 | — |
offset How many matching documents to skip before the page starts, for paging. | number | No | 0 | 0–10000000 | — |
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"doctype": "Customer",
"limit": 20,
"offset": 0,
"order_by": "modified desc",
"term": "acme"
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
items The documents on this page, in the requested order. | array | — |
count How many documents this page returned. | number | — |
doctype The DocType that was listed. | string | — |
limit The page size that was asked for. | number | — |
offset The offset this page started at. | number | — |
has_more True when the page came back full, so another may follow. | boolean | — |
term The term that was searched for. | string | — |
search_fields The fields the term was matched against. | array | — |
{
"count": 0,
"doctype": "",
"has_more": false,
"items": [],
"limit": 0,
"offset": 0,
"search_fields": [],
"term": ""
}See Search Documents run in a workflow.
In a technical demo we add the ERPNext connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.