Overview
This node integrates with the ERPNext China API, providing various operations on different resources. Specifically, for the "文件处理" (File Handling) resource and the "Base64上传" (Base64 Upload) operation, it allows users to upload files by providing their Base64-encoded content along with metadata such as file name and optional folder or document associations.
Common scenarios include:
- Uploading documents or attachments programmatically into an ERPNext system where files are stored and managed.
- Automating file uploads from other systems or workflows that produce Base64-encoded file data.
- Associating uploaded files with specific document types and names within ERPNext for better organization and retrieval.
Practical example:
- A user has a PDF report generated in another system encoded in Base64. They use this node to upload the report directly into ERPNext under a specified folder and link it to a customer record.
Properties
| Name | Meaning |
|---|---|
| File Name or ID | The name of the file to be uploaded, including its extension (e.g., document.pdf). |
| Base64内容 | The Base64-encoded content of the file to upload (e.g., SGVsbG8gRVBSTmV4dA==). |
| 选项 (Options) | Collection of optional settings: |
| - 私有文件 (isPrivate) | Boolean flag indicating if the file should be private (requires login to access). |
| - 文件夹 (folder) | Folder path where the file will be stored (e.g., Home/Attachments). |
| - 关联文档类型 (doctype) | The type of document to associate the file with (e.g., Customer). |
| - 关联文档名称 (docname) | The name of the document to associate the file with (e.g., CUST-001). |
Output
The node outputs JSON data representing the result of the file upload operation. This typically includes metadata about the uploaded file such as its unique identifier, storage location, and any ERPNext-specific references created during the upload.
If binary data is involved, it would represent the uploaded file's content or reference, but in this case, since the input is Base64 and the output is metadata, no binary output is expected.
Dependencies
- Requires connection to an ERPNext instance with appropriate API access.
- Needs an API authentication token or key configured in n8n credentials to authorize requests.
- The node depends on internal services (
FileService,DocTypeService) to interact with ERPNext APIs for file management and metadata retrieval.
Troubleshooting
Common issues:
- Incorrect or missing Base64 content can cause upload failures.
- Invalid file names or unsupported extensions might be rejected by ERPNext.
- Insufficient permissions or invalid API credentials will prevent successful uploads.
- Specifying non-existent folders or document types may lead to errors or files being stored in default locations.
Error messages:
"Resource 文件处理 not found or not implemented": Indicates the resource name is incorrect or the node does not support it.- Authentication errors suggest checking API credentials.
- Validation errors on file name or Base64 content require verifying input correctness.
To resolve these, ensure all required fields are correctly filled, credentials are valid, and referenced folders or document types exist in ERPNext.