Introducing a new way to review your PRs.

Read the announcement

frappe / crm

Fully featured, open source CRM

View on GitHub

24 documents · Updated Nov 23, 2026

docs / domain-enrichment

Domain enrichment

Domain enrichment turns a CRM record's website into useful company context. It reads public pages from the site, identifies company details and contact paths, and places the results in CRM Leads, Deals, and Organizations without using a paid data provider. The system also keeps a record of each run so a user can review where the data came from.

System purpose

Website-based company context

The subsystem uses a website as its single input and builds a small company profile from public content. Its output can include the company name, description, brand mark, industry, email addresses, phone numbers, and social profiles. The profile helps sales users start with better context while keeping the CRM record as the place where people work.

The system separates the facts it finds from the rules that decide how to use them. Administrators can tune the site search and classification knowledge in the desk. The engine then applies that knowledge to each website.

References: crm/…/README.md• L1-13 crm/…/result.py• L82-100

CRM record coverage

Enrichment applies to CRM Lead, CRM Deal, and CRM Organization records. Each record supplies its own website value, and each run writes only to the record that started the request. Settings can enable or disable the feature for each record type.

New records can also start enrichment in the background when automatic enrichment is enabled. This keeps record creation fast while allowing the website work to finish after the save.

References: crm/…/config.py• L19-25 crm/…/tasks.py• L132-155 crm/…/crm_organization.py• L31-38 crm/…/crm_lead.py• L100-109 crm/…/crm_deal.py• L106-115

Enrichment model

Website discovery

The system starts with the homepage and can follow useful links on the same site. It gives priority to pages such as About, Contact, Team, and Careers because these pages often contain the strongest company and contact signals. Crawl limits keep one website from using an unbounded amount of time or network traffic.

The crawler can use a site's sitemap as an extra source of page links. It respects robots.txt when it follows links beyond the homepage. It does not treat external sites as part of the company's site.

This diagram shows how a website becomes evidence and then becomes CRM data.

flowchart LR
    A[CRM record website] --> B[Public site pages]
    B --> C[Company and contact evidence]
    C --> D[Enrichment result with sources]
    D --> E[Mapped CRM fields]
    D --> F[Run history]

References: crm/…/crawler.py• L344-449 crm/…/pipeline.py• L122-197 crm/…/result.py• L102-121

Extracted company information

The system combines information that a site declares about itself with readable page content. Metadata can provide the company name, description, brand mark, larger social image, and social links. Page text can provide a stronger description, email addresses, phone numbers, and signals for industry classification.

Industry is not guessed from a fixed built-in list. Enabled industry rules score matching signals and produce a result only when the evidence is strong enough. Social profiles use the same kind of administrator-owned rules to recognize supported networks.

Every extracted value has provenance. Provenance means the source URL and the method that produced the value. This lets a reviewer distinguish declared metadata from a body-text match or a rule match.

References: crm/…/extractors.py• L364-403 crm/…/extractors.py• L453-503 crm/…/extractors.py• L516-593 crm/…/extractors.py• L599-644 crm/…/result.py• L18-30

CRM field mapping

Field mappings connect result values to fields on the three CRM record types. This keeps the shape of the website result separate from the shape of a CRM record. A mapping can fill an empty field, refresh a derived value, or replace a known placeholder while preserving a real user value.

The same mapping authority is used for normal enrichment and for copying company context from an Organization. Empty source values do not clear existing CRM data. A mapping may also allow a missing linked value, such as an industry, to be created when the user has permission to create it.

References: crm/…/mapper.py• L88-114 crm/…/mapper.py• L183-203 crm/…/crm_enrichment_field_mapping.json• L29-85

Record relationships

Organization context

An enriched CRM Organization can supply context when a Lead or Deal links to it. The link-time copy moves stored organization fields into empty Lead or Deal fields. It does not crawl the website again, overwrite user-entered values, update the Organization, or fan out to other linked records.

This relationship gives the CRM a useful reuse path: enrich the company once, then carry its known context into related sales records as they are connected.

References: crm/…/cross_record.py• L4-15 crm/…/cross_record.py• L79-112 crm/…/crm_lead.py• L251-302 crm/…/crm_deal.py• L103-105

Run history

Each full enrichment attempt produces one CRM Enrichment Run linked to its source record. The history shows whether the run completed or failed, which website it used, a small result summary, notes, and the full result with provenance. It also records the fields changed by a completed run so the user can undo the latest enrichment.

Run history is separate from the CRM fields. A completed run can exist even when no mapped field changed because the record already had values or the site did not provide a usable value. Undo restores values that the selected run changed while preserving later user edits when possible.

References: crm/…/tasks.py• L56-110 crm/…/api.py• L143-175 crm/…/crm_enrichment_run.json• L31-60 crm/…/crm_enrichment_run.json• L87-151

User flows

Manual enrichment

An authorized user can select Enrich from Website on a saved Lead, Deal, or Organization. The request checks that the record type is enabled, the record has a website, and the user can edit the record. The work then runs in the background, reports progress to that user, saves mapped fields, and reloads the form when it finishes.

The interface can resume a run after a page refresh and can check its status when live progress is missed. Before a repeat run, it warns that newer website values may replace fields that enrichment previously wrote. A user can undo the latest completed enrichment when the run changed fields. A retry uses the record's current website when available, so a website change affects the next attempt.

References: frontend/…/EnrichFromWebsite.vue• L183-264 frontend/…/EnrichFromWebsite.vue• L267-343 frontend/…/EnrichFromWebsite.vue• L360-421 crm/…/api.py• L110-175

Quick prefill

Create dialogs can request a bounded preview before a record exists. The preview reads only homepage metadata and returns field values for the dialog. It does not save a record, create a run, or perform the deeper page and body-text work of a full enrichment. Full enrichment can still run after the record is saved.

References: crm/…/api.py• L96-138 crm/…/pipeline.py• L54-100

System boundaries

Network safety

The fetch path accepts only public HTTP or HTTPS websites. It rejects private, loopback, link-local, reserved, multicast, and unspecified addresses. It also checks configured allow and block lists and validates each redirect. These limits protect the CRM server when a user supplies a website URL.

Manual requests, retries, and previews are rate-limited per user. Record permissions also apply: a user who cannot edit a record cannot run enrichment on it, and scraped data cannot create a linked master without create permission.

References: crm/…/README.md• L226-254 crm/…/api.py• L4-11 crm/…/mapper.py• L117-161

Site-read limits

The subsystem reads server-delivered HTML. A site that needs browser-side JavaScript may provide only its metadata, and a site behind bot protection may provide no usable content. Crawl depth, page count, request time, and page size limits keep these cases bounded rather than making the CRM wait without limit.

References: crm/…/pipeline.py• L25-27 crm/…/pipeline.py• L132-159 crm/…/config.py• L28-48

The detailed execution and configuration guide is Enrichment pipeline and rules. It covers the request lifecycle, crawl and extraction stages, rule records, field mappings, run states, and user controls.

Change checklist

When these files or sections are changed, remember to consider these:

  • When a result value changes, keep its mapper source key, field-mapping Select options, flat terminal payload, and run summary aligned.
  • When a CRM field is renamed or removed, review the related field mappings and the Organization-to-Lead/Deal copy path together.
  • When progress stages change, keep the worker event payload, status polling response, and the desk progress display in agreement.
  • When undo data changes, keep run change rows, the restore rules, the enriched-field warning, and the undo button behavior aligned.
  • When automatic enrichment triggers change, preserve the shared per-record job identity so creation and manual requests cannot start duplicate work.
  • When website fetch rules change, review redirects, allow/block lists, rate limits, and preview requests as one security boundary.

Important failure modes

TriggerConsequenceGuard
The website times out, refuses the connection, or returns server failureThe run has a failure or reachability note and may have no fields to mapBounded request time, retries, result notes, and a recorded Failed run
The site is JavaScript-rendered or protected by a bot wallMetadata may be available, but body fields and classification may be blankReadability diagnosis records a clear note instead of treating missing data as a confident result
A website or redirect resolves to a private or blocked hostNo page is fetched and enrichment cannot complete from that URLSSRF checks run for the initial URL and every redirect
A field mapping points to a missing or invalid target fieldThat value is skipped and other mappings can still proceedMappings are checked against the target record and field writes are centralized
A target record already has user dataA refresh can replace only values allowed by its policy; link-time copying never overwrites itFill-if-empty, override-default, and forced fill-empty rules
A user tries to undo while enrichment is still runningThe undo is rejected until the active run endsPer-record job tracking blocks undo during an in-flight job

Key files

FileWhy to read it
crm/…/README.mdHigh-level product goals, boundaries, and the complete subsystem map
crm/…/api.pyDefines the user-facing start, retry, status, and undo actions
crm/…/pipeline.pyConnects website discovery, extraction, classification, and the result model
crm/…/crawler.pyDefines the system's view of a site and the limits on page discovery
crm/…/extractors.pyShows which company, contact, social, and industry signals the product can produce
crm/…/mapper.pyDefines how website results become CRM field changes
crm/…/tasks.pyConnects background work, record updates, run history, and live progress
frontend/…/EnrichFromWebsite.vueShows the user flow for progress, repeat runs, status recovery, and undo
crm/…/config.pyAssembles administrator-owned settings, rules, and field mappings
crm/…/cross_record.pyDefines Organization-to-Lead and Organization-to-Deal context reuse
crm/…/crm_enrichment_settings.jsonDescribes the administrator controls for scope, crawl behavior, preview, and network safety
crm/…/crm_enrichment_run.jsonDefines the user-visible audit record for enrichment attempts