ERPNext Legal E-Billing Export (LEDES 1998B)
User Guide and Functional Documentation | Version 1.0
This guide explains how to prepare ERPNext records for legal e-billing, generate a LEDES 1998B-compatible text file from a Sales Invoice, and check the file before sending it to a client's legal e-billing platform.
The examples in this guide use sample records and identifiers. Replace them with values approved by your client or receiving platform.
1. What does the app do?
The ERPNext Legal E-Billing Export app adds a legal e-billing download action to the Sales Invoice. It collects the required information from ERPNext master data, the invoice header, and invoice item rows and produces a pipe-delimited .txt file in the documented LEDES 1998B field order.
The generated file contains 24 fields for each billing row. Invoice-level data, such as the invoice number and total, repeats on the billing rows so that each line can be understood on its own.
Important: Downloading the file is not the same as submitting or receiving acceptance from an external e-billing portal. Review the file and follow the recipient's submission instructions.
2. End-to-end workflow
Follow this sequence each time you prepare a legal e-billing export:
- Set up master records: Enter the client ID in Customer, law-firm ID in Company, timekeeper details in Employee, and task/activity codes in Item.
- Prepare the Sales Invoice header: Select the customer and company, and complete the posting date, matter references, billing period, and invoice description.
- Prepare billing lines: Add items, quantities, rates, descriptions, line dates, LEDES types, and any required expense or adjustment information.
- Review invoice amounts: Check each line amount and the overall invoice Total in ERPNext.
- Download the file: From the Sales Invoice, choose Export > Download LEDES.txt.
- Validate the output: Open the downloaded text file and compare its identifiers, dates, amounts, and billing lines with ERPNext before submitting it to the receiving portal.
3. First-time setup: Where each LEDES value comes from
Before creating the first export, confirm that the relevant fields have been entered on the following ERPNext screens. Each setup section includes an ERPNext screenshot showing the corresponding screen or controls.
3.1 Customer master: CLIENT_ID
Navigate to: Selling > Customer > Open the relevant customer.
Enter the client-specific identifier in LEDES Client ID and save the Customer record. The Customer selected in the Sales Invoice determines which client record supplies the exported ID.
| LEDES field | ERPNext source | Example |
|---|---|---|
| CLIENT_ID | Customer > LEDES Client ID | ABC-001 |
Example: If the Customer is ABC Trading Company and the client has assigned the billing ID ABC-001, enter ABC-001 in the LEDES Client ID field. Do not assume the Customer Name is the same as the external client ID.
Customer Master – LEDES Client ID
3.2 Company Master - LEDES Law Firm I
Navigate to: Company > Open the billing company
Maintain the law-firm identifier on the ERPNext Company record. The exporter uses this value to identify the billing firm.
| LEDES field | ERPNext source / meaning | Sample value |
|---|---|---|
| LAW_FIRM_ID | Company > LEDES Law Firm ID | LAW-001 |
Company master - LEDES Law Firm ID
3.3 Employee Master - Timekeeper Information
Navigate to: Employee > Open the relevant employee
Timekeeper information identifies the professional associated with a billing line. The sample employee record stores the Timekeeper ID and Timekeeper Classification, while the employee name supplies the Timekeeper Name used in the export.
| LEDES field | ERPNext source / meaning | Sample value |
|---|---|---|
| TIMEKEEPER_ID | Employee > Timekeeper ID | TK-001 |
| TIMEKEEPER_NAME | Employee name | Ahmed |
| TIMEKEEPER_CLASSIFICATION | Employee > Timekeeper Classification | Associate |
Data governance: Keep timekeeper identifiers and classifications controlled in the Employee master. This avoids hard-coded values in the export and supports consistent billing when multiple professionals are used.
Employee master - Timekeeper ID and classification
3.4 Sales Invoice Header - Invoice and Matter Information
Navigate to: Accounting > Sales Invoice > Open or create the relevant Sales Invoice
The Sales Invoice header contains the primary invoice, matter and billing-period information. One screenshot is used because all of the following LEDES fields are sourced from this screen.
| LEDES field | ERPNext source / meaning | Sample value |
|---|---|---|
| INVOICE_DATE | Posting Date | 04-10-2026 -> 20261004 |
| INVOICE_NUMBER | Sales Invoice document number | ACC-SINV-2026-00036 |
| LAW_FIRM_MATTER_ID | Our Reference | MAT-2026-001 |
| BILLING_START_DATE | Billing Start Date | 01-09-2026 -> 20260901 |
| BILLING_END_DATE | Billing End Date | 30-09-2026 -> 20260930 |
| INVOICE_DESCRIPTION | LEDES Invoice Description | Legal services ... September 2026 |
| CLIENT_MATTER_ID | Your Financial Ref | ABC-MAT-2026-001 |
Related master data: The Customer selected on the Sales Invoice is also used to retrieve CLIENT_ID from the Customer master. CLIENT_ID is therefore not typed separately on the invoice.
Sales Invoice header fields used by the LEDES export
3.5 Sales Invoice Items - Quantities, Rates and Amounts
Navigate to: Sales Invoice > Items table
The item grid supplies the quantity, unit rate and line amount for each billing row. The Sales Invoice total is exported as the invoice-level total and repeats on each LEDES billing row.
| LEDES field | ERPNext source/meaning | Sample value |
|---|---|---|
| INVOICE_TOTAL | Sales Invoice > Total | 6750.00 |
| LINE_ITEM_NUMBER | Item row number / No. | 1 |
| LINE_ITEM_NUMBER_OF_UNITS | Item > Quantity | 5.00 |
| LINE_ITEM_TOTAL | Item > Amount | 4000.00 |
| LINE_ITEM_UNIT_COST | Item > Rate | 800.00 |
Sales Invoice item grid and invoice total
3.6 Sales Invoice Item Detail - LEDES Line-Level Fields
Navigate to: Sales Invoice > Items table > Click the pencil/edit icon on the relevant item row
Open the item row using the edit icon to maintain the LEDES line-level attributes. The visible screen contains the description, line type, adjustment amount, line date and expense code. Task and activity codes are maintained on the linked Item master and are documented separately in Section 3.7.
| LEDES field | ERPNext source / meaning | Sample value |
|---|---|---|
| EXP/FEE/INV_ADJ_TYPE | Item > LEDES Type | F |
| LINE_ITEM_ADJUSTMENT_AMOUNT | Item > LEDES Adjustment Amount | 0.00 |
| LINE_ITEM_DATE | Item > LEDES Line Date | 04-10-2026 -> 20261004 |
| LINE_ITEM_EXPENSE_CODE | Item > LEDES Expense Code | EXP-001 |
| LINE_ITEM_DESCRIPTION | Item > Description | Contract Review - Senior Lawyer |
Line-type behavior: In the sample output, F is used for fee lines and E is used for expense lines. Enter the expense code when required for the billing line. Task and activity codes are maintained on the Item master as shown in Section 3.7.
Expanded Sales Invoice Item showing LEDES line-level fields
3.7 Item Master - LEDES Task and Activity Codes
Navigate to: Stock > Item > Open the relevant Item
Maintain the LEDES task and activity codes on the Item master. When the item is used on a Sales Invoice, these values provide the billing codes exported for the corresponding LEDES line. The codes should match the values required by the receiving client or e-billing platform.
| LEDES field | ERPNext source / meaning | Sample value |
|---|---|---|
| LINE_ITEM_TASK_CODE | Item Master > Task Code | TASK-003 |
| LINE_ITEM_ACTIVITY_CODE | Item Master > Activity Code | ACT-003 |
Billing code control: Use the client-approved task and activity codes. Maintaining the values on the Item master keeps the billing-code source consistent for repeated use of the same service item
Item master with LEDES Activity Code and Task Code
4. Complete LEDES® 1998B Field Mapping
The exporter writes the following 24 fields in the fixed order shown below. Dates are represented in the generated text file as YYYYMMDD. Invoice-level values repeat across billing rows so that each line remains complete in context.
| # | LEDES field | ERPNext source | Example |
|---|---|---|---|
| 1 | INVOICE_DATE | Sales Invoice - Posting Date | 20261004 |
| 2 | INVOICE_NUMBER | Sales Invoice document number | ACC-SINV-2026-00036 |
| 3 | CLIENT_ID | Customer - LEDES Client ID | ABC-001 |
| 4 | LAW_FIRM_MATTER_ID | Sales Invoice - Our Reference | MAT-2026-001 |
| 5 | INVOICE_TOTAL | Sales Invoice - Total | 6750.00 |
| 6 | BILLING_START_DATE | Sales Invoice - Billing Start Date | 20260901 |
| 7 | BILLING_END_DATE | Sales Invoice - Billing End Date | 20260930 |
| 8 | INVOICE_DESCRIPTION | Sales Invoice - LEDES Invoice Description | Legal services ... |
| 9 | LINE_ITEM_NUMBER | Sales Invoice Item - Row number | 1 |
| 10 | EXP/FEE/INV_ADJ_TYPE | Sales Invoice Item - LEDES Type | F |
| 11 | LINE_ITEM_NUMBER_OF_UNITS | Sales Invoice Item - Quantity | 5.00 |
| 12 | LINE_ITEM_ADJUSTMENT_AMOUNT | Sales Invoice Item - LEDES Adjustment Amount | 0.00 |
| 13 | LINE_ITEM_TOTAL | Sales Invoice Item - Amount | 4000.00 |
| 14 | LINE_ITEM_DATE | Sales Invoice Item - LEDES Line Date | 20261004 |
| 15 | LINE_ITEM_TASK_CODE | Item Master - Task Code | TASK-003 |
| 16 | LINE_ITEM_EXPENSE_CODE | Sales Invoice Item - LEDES Expense Code | EXP-001 |
| 17 | LINE_ITEM_ACTIVITY_CODE | Item Master - Activity Code | ACT-003 |
| 18 | TIMEKEEPER_ID | Employee - Timekeeper ID | TK-001 |
| 19 | LINE_ITEM_DESCRIPTION | Sales Invoice Item - Description | Contract Review - Senior Lawyer |
| 20 | LAW_FIRM_ID | Company - LEDES Law Firm ID | LAW-001 |
| 21 | LINE_ITEM_UNIT_COST | Sales Invoice Item - Rate | 800.00 |
| 22 | TIMEKEEPER_NAME | Employee name | Ahmed |
| 23 | TIMEKEEPER_CLASSIFICATION | Employee - Timekeeper Classification | Associate |
| 24 | CLIENT_MATTER_ID | Sales Invoice - Your Financial Ref | ABC-MAT-2026-001 |
5. Exporting a Sales Invoice
Use the following procedure after the master values, invoice header and item-level LEDES fields have been prepared and reviewed.
5.1 Open the Export menu
From the Sales Invoice header, select Export. The custom legal e-billing action is available from this menu.
Export control in the Sales Invoice header
5.2 Select Download LEDES.txt
Select Download LEDES.txt. The browser downloads a plain-text file containing the mapped invoice and billing-line information in LEDES® 1998B-compatible field order
Download LEDES.txt option
6. Validating the Generated LEDES File
The generated output begins with the LEDES1998B format identifier, followed by the 24-field header and the billing rows. Fields are separated by the pipe character | and each record ends with the two-character LEDES row terminator: an opening square bracket immediately followed by a closing square bracket.
• Confirm that the 24 header fields appear in the documented order.
• Confirm that invoice-level identifiers and totals repeat consistently across billing rows.
• Confirm that each billing row contains the correct line number, line type, units, amount, date, billing codes and timekeeper details.
• Confirm that dates are exported as YYYYMMDD (for example, 04-10-2026 becomes 20261004).
• Blank optional values should remain represented by adjacent pipe separators; do not manually remove or reorder separators.
Sample validation: The sample output shows CLIENT_ID = ABC-001, LAW_FIRM_MATTER_ID = MAT-2026-001, LAW_FIRM_ID = LAW-001, TIMEKEEPER_ID = TK-001, TIMEKEEPER_NAME = Ahmed, TIMEKEEPER_CLASSIFICATION = Associate, and CLIENT_MATTER_ID = ABC-MAT-2026-001. The file should always be reconciled against the corresponding ERPNext invoice before submission.
Generated LEDES text file opened in a plain-text editor
7. Validation & Troubleshooting
7.1 Pre-submission checklist
☐ Invoice number and invoice date match the ERPNext Sales Invoice.
☐ CLIENT_ID, LAW_FIRM_MATTER_ID, LAW_FIRM_ID and CLIENT_MATTER_ID match the receiving client requirements.
☐ Invoice total and all line totals reconcile with ERPNext.
☐ Fee, expense and adjustment line types are correct.
☐ Required task, activity and expense codes are populated.
☐ Timekeeper ID, name, classification and rate are complete where required.
☐ Billing period and line-item dates are valid.
☐ Line descriptions comply with the client billing guidelines.
7.2 Common issues
| Issue | Possible reason | Recommended action |
|---|---|---|
| Download option missing | App/feature unavailable or insufficient access. | Confirm app installation and Sales Invoice permissions. |
| Blank fields | Required source data or mapping is missing. | Complete the relevant customer, company, invoice, item or employee data and export again. |
| Portal rejection | Client-specific rule or invalid identifier/code. | Review the portal rejection and compare the exported values with the client billing rules. |
| Amount mismatch | Line values, adjustments, taxes or mapping differ. | Reconcile each exported billing row with the source invoice and configured export logic. |
| Duplicate submission | Invoice was submitted previously. | Check the receiving portal status before resubmitting. |
7.3 Operational recommendations
• Use controlled master data for client IDs, matter IDs, law-firm IDs, billing codes and timekeeper information.
• Keep the ERPNext Sales Invoice number linked to the external submission status for reconciliation and audit.
• Validate at least one sample export against the intended client e-billing platform before production rollout.
• Treat file generation as the start of submission validation, not as final acceptance; the receiving platform may apply additional client-specific checks.
8. Reference
LEDES® 1998B field order and file structure are represented in this guide as implemented by the ERPNext Legal E-Billing Export app. Client-specific e-billing rules may impose additional validation requirements beyond the generated file structure.