# DeleteClaimLedgerEntry - Advanced Documentation ## Overview Deletes a ledger entry from a claim. Performs cascading cleanup of invoice and disbursal associations before deletion. Cannot delete entries that are on sent invoices or completed disbursals. ## Validation Rules Before deletion, the system validates: 1. `LedgerEntry.Claim.ID` must be >= 1 2. `LedgerEntry.ID` must be >= 1 3. Entry must exist on the claim 4. Entry must NOT be on a **sent invoice** (Invoiced > 0 with sent status) 5. Entry must NOT be on a **completed disbursal** If the entry is referenced by an invoice or disbursal that hasn't been sent/completed, the association is automatically removed before deletion. ## Cascading Operations On deletion: 1. Removes entry from any associated invoices (if not sent) 2. Removes entry from any associated disbursals (if not completed) 3. Updates parent claim Timestamp (optimistic concurrency) 4. Triggers claim finalization (`CreateEntityFinishClaimRun`) ## Required Input Pass a `LedgerEntryInfo` object with at minimum: - `ID` - the ledger entry ID to delete - `Claim.ID` - the parent claim ID ## Script Example ```javascript async () => { const entry = { ID: 12345, Claim: { ID: 771360 } }; const result = await SecureApi.DeleteClaimLedgerEntry(entry); return { deleted: result.ID }; } ``` ## Error Conditions - `Claim.ID < 1` - throws RadoloException - `LedgerEntry.ID < 1` - throws RadoloException - Claim not found - throws RadoloException - Entry on sent invoice - throws InvalidOperationException: "This ledger entry is currently being used on a sent invoice..." - Entry on completed disbursal - throws InvalidOperationException: "This ledger entry is currently being used on a completed disbursal..."