Templates / Validate procurement records and learn error patterns with Gemini and Data Tables

Validate procurement records and learn error patterns with Gemini and Data Tables

Ready for 3.0

by WeblineIndia ✓ · 1 views · created 2026-09-28 · Document Extraction, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (9)

Basic LLM ChainGoogle Gemini Chat Model

What it does

Quick Overview This workflow receives procurement line-item data via a webhook, validates and normalizes it, checks for known recurring error patterns in an n8n Data Table, and uses Google Gemini to detect semantic anomalies when needed, returning an immediate JSON accept/reject response and learning new error patterns. How it works 1. Receives a procurement record as a POST request via a webhook. 2. Applies configurable rules to normalize fields (including unit aliases) and run deterministic checks for required fields, quantity/price validity, subtotal math, and tax calculations. 3. Builds a pattern signature from key fields and looks it up in the n8n Data Table to see if the same error pattern has been seen before. 4. If a trusted recurring pattern is found (high confidence and enough occurrences), reuses the stored correction details and skips AI review. 5. If no trusted pattern is found, sends the record and deterministic results to Google Gemini to identify contextual anomalies (for example category, coding, supplier-item, or unit inconsistencies) and suggested corrections. 6. Combines deterministic errors, historical pattern matches, and Gemini findings into a single decision and returns a JSON response indicating whether the record is accepted along with any detected issues. 7. When issues are detected, upserts the error pattern (including counts, confidence, and summary) into the n8n Data Table to improve future detections. Setup 1. Create an n8n Data Table named procurementerrorpatterns with columns such as patternkey, supplier, itemcode, errortype, incorrectvalue, suggestedvalue, reason, occurrencecount, confidence, firstseen, lastseen, source, and issuesummary. 2. Add a Google Gemini (PaLM) credential and select it in the Google Gemini Chat Model node. 3. Review and adjust the defaults in the workflow (required fields, default currency and tax rate, subtotal/tax tolerances, and AI/pattern confidence and recurring thresholds) to match your procurement rules. 4. Send JSON records to the webhook endpoint (copy the production URL from the webhook node), using fields like supplier, itemcode, description, category, quantity, unit, unitprice, subtotal, taxrate, taxamount, and currency.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.