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 / api-and-event-services

API and event services

API and event services connect the CRM client to the server. They provide shared access to CRM records, forms, comments, activities, users, settings, notifications, calendar events, public booking, morning work digests, messaging, work discovery, and automation events while leaving record storage and access rules to the Frappe service platform. See the CRM service platform for the wider system model, CRM configuration and metadata for the settings that shape these services, and workflow automation for how event signals drive flows.

System boundary

Client request path

The client reaches server work through frappe-ui resources. A resource either names a Frappe DocType for standard list or document work or names a dotted, whitelisted CRM method for a focused operation. The server checks the session and permissions, reads or changes records, and returns data that the client stores in reactive state.

The main path from a screen to a server result is:

flowchart LR
    Screen[CRM screen] --> Resource[frappe-ui resource]
    Resource -->|DocType resource| Frappe[Frappe document service]
    Resource -->|crm.api dotted method| API[CRM API module]
    API --> Records[CRM records and related records]
    Frappe --> Records
    Records --> Response[Response or realtime event]
    Response --> State[Client state and view]

Focused methods use the crm.api namespace. Standard Frappe methods remain in use when the operation is generic, such as login, document permissions, email sending, or file deletion. This split keeps CRM-specific rules near the feature while using the platform for common document behavior.

References: frontend/…/document.js• L16-86 frontend/…/session.js• L19-37 frontend/…/CommunicationArea.vue• L206-241 crm/…/doc.py• L24-51

Access boundary

The server is the authority for access. CRM sessions must have a CRM role, record reads still pass through record permissions, and manager-only operations apply a stronger role check. The client can hide controls for convenience, but it does not grant access.

Public forms are a separate boundary. A visitor can submit a published CRM form without a CRM session. Link fields show only records that the visitor may select, and a form manager must make that exposure an explicit choice.

References: crm/…/session.py• L4-19 crm/…/activities.py• L13-25 crm/…/form.py• L234-276 crm/…/crm_form.py• L24-43

Shared API utilities

The shared crm/…/__init__.py module provides cross-cutting operations that support several client and public flows. It supplies translations and email signatures, filters unsubscribed recipients, checks that a user belongs to the CRM app, and returns file-upload limits from system and DocType settings.

The same boundary manages invitations and attachment removal. Invitation acceptance is safe for a guest link and can redirect an existing user through login or send a new user to password setup. Invitation creation is limited to managers, while attachment deletion still checks write access to the source record.

References: crm/…/__init__.py• L14-54 crm/…/__init__.py• L57-99 crm/…/__init__.py• L102-166 crm/…/__init__.py• L169-197

Record services

Record browsing

The record API gives list views one shared way to discover and present CRM records. It builds filter, sort, group, list, and Kanban data from DocType metadata and saved CRM view settings. This lets the client change the shape of a view without creating a separate server method for each screen.

The same service also returns field descriptions, counts, scripts, and available views. Managers can choose quick filters for a record type, and those choices shape the filter controls shown to users. For DocTypes that track seen state, list results include _seen, and a separate operation records that the current user has seen a document. The client uses these results to build filters and columns that match the current record type and to reflect visit state in list views.

References: crm/…/doc.py• L24-51 crm/…/doc.py• L54-253 crm/…/doc.py• L256-553 crm/…/doc.py• L601-624 frontend/…/ViewControls.vue• L539-548 frontend/…/Filter.vue• L180-205

Record relationships

CRM records can carry assignments and links to related records. The record API resolves active assignees, finds linked documents through direct and dynamic links, and can remove a link or delete a selected set of related records. These operations keep the record view and its related work aligned when a user changes ownership or removes a record.

References: crm/…/doc.py• L601-644 crm/…/doc.py• L696-737 crm/…/doc.py• L740-858 frontend/…/document.js• L118-145 frontend/…/DeleteLinkedDocModal.vue• L159-211

Linked field values

Linked field values provide a client-side preview of values defined by Frappe’s fetch_from property. When a link changes, the client asks the linked DocType for the required source fields, fills pending target fields, and leaves fields marked fetch_if_empty unchanged once they already have a value. The server recomputes these values on save, so the client path improves the form view but does not replace server validation.

The same rule also controls editing. A fetched field is disabled while its link has a value, including fields inside a grid row, so the displayed value remains tied to the selected linked record.

References: frontend/…/fetchFrom.js• L1-60 frontend/…/document.js• L315-364 frontend/…/Field.vue• L555-569 frontend/…/Grid.vue• L567-579

Field metadata and validation

Client field metadata is normalized before it reaches form controls. Permission changes from the server and field changes from scripts shape the effective field, while select and user-link values become controls that the client can render consistently.

The same shared field path adapts Address state choices to the selected country when regional data exists. It also checks required fields by applying hidden and required overrides plus dependency rules before a document save or a layout change. This keeps client feedback aligned with the active field rules without replacing server validation.

References: frontend/…/fieldTransforms.js• L34-72 frontend/…/fieldTransforms.js• L96-125 frontend/…/fieldTransforms.js• L138-178 frontend/…/document.js• L251-270 frontend/…/Field.vue• L488-513 frontend/…/FieldLayoutDialog.vue• L186-210

The command palette gives a user one permission-filtered entry point for CRM records and related work. A query searches leads, deals, contacts, organizations, and indexed activity, while an empty query shows recent records plus a short list of assigned tasks and response deadlines.

Activity hits open the readable lead or deal that owns the activity. If a lead was converted, the result points to its readable deal so the user reaches the current record rather than an old one. The service returns route data with each result so the client can open the right screen without a second lookup.

References: crm/…/command_palette.py• L9-36 crm/…/command_palette.py• L39-113 crm/…/command_palette.py• L124-165 crm/…/command_palette.py• L168-250

Dashboard services

Dashboard metrics

The dashboard API turns a saved dashboard layout into date- and user-scoped sales metrics. It supplies summary numbers and charts for leads, deals, revenue, conversion, stages, sources, territories, and salespeople. Sales users are limited to their own results, while managers can view the selected user or wider sales data.

The dashboard keeps chart selection separate from chart data. Core chart options are combined with valid chart contributions from other apps, and each selected chart resolves to data that matches the dashboard’s display type. The client can load the layout, edit and save it, restore the manager default, and use the same date and user filters for each result.

References: crm/…/dashboard.py• L19-207 frontend/…/Dashboard.vue• L241-305 frontend/…/dashboard.js• L10-28

Form services

Form authoring

The form API provides a CRM-scoped builder over Frappe Web Form records. It limits forms to lead and deal capture, supplies a safe field catalog, seeds a useful starting layout, and stores the author’s labels, rules, messages, route, publish state, and optional success redirect. CRM managers control this surface rather than general website managers.

The API checks the field catalog again when it saves a form. This prevents a client from mapping denied fields or changing a field’s type. Mandatory fields that stay out of the visible form use stored defaults, and publication is blocked until those defaults are present. An update that omits the field layout keeps the existing layout.

Link fields need special care because a public form can list existing records. The builder can inspect whether Guest users may select a link target and can grant only the narrow select access needed for a CRM form link. A preview must apply the Guest view without damaging the manager’s active session. A booking-page editor can update that page’s questions, while the page owner retains control of its route, target type, publication, and redirect.

References: crm/…/form.py• L4-20 crm/…/form.py• L34-73 crm/…/form.py• L127-231 crm/…/form.py• L234-323 crm/…/form.py• L345-429 crm/…/form.py• L457-481 frontend/…/FormsList.vue• L169-254 frontend/…/FormBuilderPanel.vue• L1240-1485

Form submission

The public form page serves only a published CRM form unless an authorized manager is previewing it. Frappe’s Web Form engine performs the public submission, then the CRM enrichment step applies hidden defaults and the normal source and relationship behavior before the new lead or deal is saved. Deal submissions can also create and link an organization and a primary contact from the submitted details.

This design gives public capture the same business meaning as manual CRM creation without adding a second guest-facing record API. The form route can also support an allow-listed embedded page. A draft preview can validate required visible fields without creating a CRM record.

References: crm/…/crm_form.py• L24-81 crm/…/crm_form.py• L84-128 crm/…/crm_form.py• L131-143 crm/…/form.py• L522-638 crm/hooks.py• L163-219

Conversation and activity services

Comments and mentions

The comment API adds an HTML comment to a CRM lead or deal and attaches files to that comment when supplied. When a comment contains a user mention, the comment event creates a CRM notification that points the recipient back to the source record.

The client uses this service for the comment side of the communication area. Email uses Frappe’s standard communication method, so both kinds of conversation can appear in the record timeline.

References: crm/…/comment.py• L12-67 crm/…/comment.py• L70-128 frontend/…/CommunicationArea.vue• L231-246 crm/hooks.py• L174-181

Scheduled email actions

The email service lets the owner of a scheduled communication cancel it back to an editable draft or send it immediately. It checks that the message is still scheduled and that its queue entries have not started, so a user cannot edit or race with an email that is already being sent.

When a scheduled message is sent, its communication date reflects the actual send time rather than the planned time. Attachments that belong to the source record are returned with a cancelled draft so the user can continue editing the same message.

References: crm/…/email.py• L6-42 crm/…/email.py• L45-69 crm/…/email.py• L71-93

Activity timeline

The activity API turns the history of a lead or deal into one client-facing timeline. It combines creation, field changes, comments, email communications, attachment changes, calls, notes, tasks, and files. Deal history can include the earlier lead history when the deal came from a converted lead, but only when the current user can read that lead.

The response separates the timeline from related calls, notes, tasks, and attachments. The client can therefore show a unified history while still giving each related work type its own view or action.

References: crm/…/activities.py• L13-20 crm/…/activities.py• L23-177 crm/…/activities.py• L180-318 crm/…/activities.py• L379-498 frontend/…/Activities.vue• L522-548

Record assignments

Assignment events connect CRM work to ownership and user alerts. An open assignment to a lead or deal requires write access, makes the assignee the current record owner, and sends an in-app notification; cancelling the assignment clears that owner and sends a removal notice. Assignments to CRM tasks route the notification to the task’s linked lead or deal.

References: crm/…/todo.py• L7-40 crm/…/todo.py• L42-61 crm/…/todo.py• L64-94 crm/…/todo.py• L152-157

WhatsApp conversations

The WhatsApp service connects messages to CRM records and keeps the conversation visible to the right sales users. It resolves a sender’s phone number to matching contacts, leads, or deals. An enabled account can also create a lead from a new incoming sender when its append rule requests that behavior.

The service links the WhatsApp profile to all matching CRM entities and notifies assigned users when an incoming message reaches a lead or deal. It also warns before a user changes a record’s phone number when that change would hide an existing conversation. Access remains limited to CRM sales roles and the WhatsApp app’s own document permissions.

The client can check whether WhatsApp is installed and active before it shows messaging actions. It can also check which WhatsApp records still use an account before a delete request, so account links are clear to the user instead of appearing only as a server error.

References: crm/…/whatsapp.py• L13-40 crm/…/whatsapp.py• L42-150 crm/…/whatsapp.py• L153-195 crm/…/whatsapp.py• L210-275 crm/…/whatsapp.py• L284-349

Identity and user services

Session state

The session store tracks whether the browser has a logged-in user and delegates login and logout to Frappe’s standard endpoints. The server session API turns the current user’s roles into CRM role flags, which gives the client a shared view of system manager, sales manager, and sales user access.

References: frontend/…/session.js• L6-44 crm/…/session.py• L4-19

User directory

The user service supplies the people needed by CRM screens, such as owners, assignees, comment authors, and event participants. The first request favors CRM users so the interface becomes useful quickly. A system manager may receive the full enabled user list, while a capped lookup fills gaps for activity users during the background load.

The same session service returns organizations for client-side lookup. User and organization stores cache these results by name so record views can resolve display names without repeating the same request.

References: crm/…/session.py• L22-134 crm/…/session.py• L137-171 frontend/…/users.js• L7-110 frontend/…/organizations.js• L6-31

User availability

User availability gives the desk a shared view of whether a CRM user is active or in another status. The server validates that a selected status is enabled, records who changed it and when, and publishes the update after commit so all desk users can refresh the status indicator.

Users without a configured status count as Active. Status changes and changes to the available status list use separate realtime events, which keeps user indicators and status choices current without a full page reload.

References: crm/…/availability.py• L6-16 crm/…/availability.py• L19-50

User administration

The user service handles password setup, password changes, and CRM membership changes. A password change needs the current password and a policy-compliant new password. Failed attempts are tracked and the endpoint is rate limited. First-time password setup is allowed only when the user has no password and does not use a password-exempt login path such as SSO or LDAP.

Managers can add or change CRM roles within the system-manager rules. Role updates respect Role Profiles and sales-hierarchy constraints, and they update the modules available to the user. A user who joins the CRM can also receive the Flow User role when it exists. Later role changes do not restore that role after an administrator removes it.

References: crm/…/user.py• L8-108 crm/…/user.py• L111-132 crm/…/user.py• L135-205 crm/…/user.py• L208-284 crm/…/crm.py• L14-56 frontend/…/Users.vue• L250-294

Onboarding record selection

The onboarding service gives the first-use flow a safe lead or deal to open after setup. It first keeps the record created during onboarding when that record still exists, remains eligible, and is readable by the current user; otherwise it selects the earliest readable record of the needed type. If no suitable record exists, the service returns no record so the client can continue without opening an invalid route.

References: crm/…/onboarding.py• L4-33

Notification and settings services

In-app notifications

The notification API returns the 50 newest CRM notifications for the current recipient and maps each item to a CRM route or related document. It resolves sender and reply names for user mentions, email replies, and WhatsApp replies, then returns a short plain-text preview. A read operation can mark all matching unread notifications or only those tied to a selected document.

Mentions, assignments, WhatsApp messages, bookings, and other feature events create the notification records that this service reads. The client derives the unread count from the returned list and reloads it after a read action; the server also exposes a count for the current user.

References: crm/…/notifications.py• L9-77 crm/…/notifications.py• L80-118 crm/…/notifications.py• L121-171 frontend/…/notifications.js• L8-43 crm/…/comment.py• L16-57 crm/…/whatsapp.py• L170-183

Morning work digest

The morning digest gives each sales user one email view of work that needs attention. It follows the same user scope as the CRM home brief and groups today’s meetings, due follow-ups, waiting replies, new assignments, and tasks due today.

The scheduler sends at most one digest per user per local day during the morning window. Users can opt out, and the service skips the run when no outgoing email account is available. The email links each item back to the matching calendar, record, conversation, or task view.

References: crm/…/digest.py• L32-69 crm/…/digest.py• L71-145 crm/…/digest.py• L168-289

CRM settings

The settings store loads the single FCRM Settings record and exposes its brand data to the client. The settings API adds supported email accounts by translating a small set of service choices into Frappe Email Account records and checking incoming credentials before saving them.

Event reminder defaults also live in FCRM Settings. The settings page therefore influences both the product’s visual context and later event processing.

References: frontend/…/settings.js• L1-30 crm/…/settings.py• L4-47 crm/…/event.py• L192-243

Event services

Calendar event data

The event composable loads events and then joins their participants and reminder rows. It can scope the event list to a CRM record, or load the wider calendar, so the same data path supports record timelines and calendar views. The client converts the server event shape into the dates, times, people, and links used by the event form.

References: frontend/…/event.js• L10-67 frontend/…/event.js• L68-137 frontend/…/event.js• L255-284

Event visibility and calendar sync

CRM event reads include events visible through normal Event permissions and events linked to a lead or deal that the user can read. This lets a team see a meeting in the related record even when Frappe’s private event rules would otherwise show it only to the owner and participants. Event writes still use Frappe’s event permissions, with the CRM allowing the event owner to delete their own event.

When an event asks for Google sync, the service uses the creator’s connected calendar when one is available. A Google failure does not block the CRM event; the event remains local until a later sync can succeed.

References: crm/…/event.py• L464-601 crm/…/event.py• L604-651

Event reminders

The event service sends reminders for events that are starting soon or are already in progress. It checks both the event owner and participants, skips cancelled events, and supports email and realtime system notifications. An event’s own reminder rows take priority; when none exist, matching regular or all-day defaults from FCRM Settings supply the reminders.

Scheduled jobs check minute, hour, day, and week intervals. A time window around each target lets a scheduled run deliver a reminder without requiring the scheduler to run at the exact trigger second. A per-event, per-reminder, per-recipient marker prevents overlapping jobs from sending the same reminder twice, while failed sends remain eligible for a later retry.

References: crm/…/event.py• L27-161 crm/…/event.py• L164-243 crm/…/event.py• L246-369 crm/…/event.py• L372-461 crm/hooks.py• L221-242

Public booking pages

Public booking pages let a visitor choose a time with one or more CRM hosts without a CRM account. The service builds slots from weekly hours and holidays, removes busy time from CRM events and an optional connected Google Calendar, and returns times in UTC so the page can display them in the visitor’s time zone.

A booking creates an Event and links it to an existing lead or deal when the visitor matches one. If no match exists and the page allows record creation, the same form enrichment used by public CRM forms creates the selected record. The guest receives a management token for cancellation or rescheduling, while the host and the linked record owner receive CRM notifications.

The booking flow also sends confirmation, change, cancellation, and reminder email. Rate limits, per-email limits, host locks, and a final free-slot check protect public pages from abuse and prevent two visitors from taking the same slot.

This diagram shows how a public booking becomes CRM work and a calendar event.

flowchart LR
    Visitor[Booking page visitor] --> Slots[Available slots]
    Slots --> Booking[Booking with secret token]
    Booking --> Record[Existing or new lead/deal]
    Booking --> Event[CRM Event]
    Event --> Calendar[CRM or Google Calendar]
    Booking --> Messages[Guest email and CRM notifications]

References: crm/…/booking.py• L58-197 crm/…/booking.py• L200-250 crm/…/booking.py• L513-546 crm/…/booking.py• L552-769 crm/…/booking.py• L798-845 crm/…/booking.py• L907-1100 crm/…/booking.py• L1144-1294

Automation event delivery

CRM automation events turn important record and message changes into signals that an Automation Flow can use. The event service publishes identifiers and small state values rather than message bodies, so flows can wait on a lead, deal, task, or message thread without copying sensitive content into event records.

The signals cover prospect messages, lead qualification and conversion, deal stage and outcome changes, and overdue tasks. Message events use both the conversation thread and the related lead or deal as correlation choices. Record events use the affected record, while the hourly overdue-task sweep resumes from its last point and limits recovery to a useful time window.

This diagram shows how CRM changes become flow triggers while keeping the event payload separate from the source record.

flowchart LR
    Change[CRM record or message change] --> Hook[CRM document hook or scheduled sweep]
    Hook --> Event[Automation event]
    Event -->|record or thread correlation| Flow[Automation Flow]
    Flow --> Action[Flow action]

References: crm/…/events.py• L4-12 crm/…/events.py• L25-47 crm/…/events.py• L50-155 crm/hooks.py• L158-232 crm/hooks.py• L270-301 crm/hooks.py• L353-362

Change checklist

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

  • Keep every client resource URL aligned with the matching whitelisted method name and its response shape. Resource transforms often assume a fixed tuple or object structure.
  • When changing shared API methods, keep their guest or session boundary, rate limit, permission check, return shape, and client callers aligned.
  • When changing invitations, keep key validation, manager-only creation, login redirect, transaction commit, and first-password setup aligned.
  • When changing attachment or file-upload rules, keep source-record permission checks, DocType limits, system limits, and client uploader behavior aligned.
  • When changing lead or deal creation rules, update both manual creation behavior and enrich_form_submission; public form records must keep the same source and relationship meaning.
  • When changing form field or hidden-default rules, keep the builder catalog, save-time validation, publication guard, and public submission path aligned.
  • When changing booking-page form rules, keep the page editor limits, required email field, public slot flow, and form enrichment aligned.
  • When changing public booking behavior, keep slot visibility, host locking, guest tokens, lead/deal linking, Event state, Google busy time, emails, and CRM notifications aligned.
  • When changing list data for DocTypes that track seen state, keep _seen loading and the document-level seen action aligned with the client’s visited-record display.
  • When changing dashboard chart names, chart types, or contributed resolvers, keep the saved layout, chart options, data lookup, and dashboard renderer aligned.
  • When changing fetch_from behavior, keep source parsing, linked value lookup, stale-response handling, field locking, and server-side save recomputation aligned.
  • When changing field metadata or required-field rules, keep permission and script overrides, dependency evaluation, field rendering, and pre-save checks aligned.
  • When changing command palette result kinds or route fields, keep record search, indexed activity search, recent items, upcoming work, and client navigation aligned.
  • When changing notification fields, page size, or reference doctypes, update both notification creation and the client route and unread-count mapping in the notification store.
  • When changing digest sections or links, keep the Home scope, local-time window, opt-out state, sender check, and destination route aligned.
  • When changing WhatsApp reference or phone rules, keep profile linking, incoming lead creation, assigned-user notifications, conversation display, and recipient-change confirmation aligned.
  • When changing WhatsApp account lifecycle checks, keep installation and active-account detection aligned with account usage counts, link permissions, and the client’s delete or messaging actions.
  • When changing availability statuses, keep status validation, category fallback, realtime event names, and desk status consumers aligned.
  • When changing scheduled email state transitions, keep Communication status, Email Queue state, ownership checks, attachment recovery, and actual send dates aligned.
  • When changing event visibility or Google sync, keep event list filters, linked-record access, owner deletion, calendar selection, and failure fallback aligned.
  • When changing event reminder intervals or settings rows, update the scheduler entry points, scan horizon, trigger windows, recipient claim keys, and custom-versus-global reminder selection together.
  • When changing automation event names, payload keys, subjects, or correlation choices, keep the emitters, hook registration, Automation Flow builder metadata, and flow references aligned.
  • When changing overdue-task event recovery, keep the hourly scheduler, sweep cursor, lookback limit, and per-task correlation behavior aligned so delayed jobs do not lose or repeat useful triggers.
  • When changing user roles, check session access flags, user list filtering, administration rules, Flow User joining behavior, role-profile ownership, and any sales hierarchy constraints as one contract.
  • When changing password setup checks, keep set_password, the CRM page redirect, and the exceptions for SSO, LDAP, Frappe Cloud, and disabled password login aligned.
  • When changing onboarding creation or conversion rules, keep the preferred-record checks aligned with the fallback selection so the first-use flow does not open an unreadable or ineligible record.

Important failure modes

TriggerConsequenceGuard
A CRM API response changes shape without a matching client transformLists, activity tabs, or user stores can show empty or misread dataKeep the method response and the consuming frappe-ui resource transform aligned
A shared API method loses its guest, session, or rate-limit guardA public or authenticated operation can become available to the wrong callerKeep access and abuse checks at the method boundary and verify its caller contract
An invitation key is accepted without its redirect and commit pathAn existing user may not reach the invitation flow or a new user may not be createdValidate the key, redirect through login when needed, and commit the GET-based acceptance
A list path omits _seen for a DocType that tracks seen stateA visited lead or deal can keep the wrong visual state in list viewsAdd _seen to list data and keep the document-level seen action available
A dashboard layout names an unavailable chart or a contributed resolver is invalidA dashboard item can have no data or fail to load while other items remain visibleKeep chart names unique and validate chart contributions before exposing them
A linked-value response is applied after the user changes the link againA form can show values from the wrong linked recordIgnore responses whose link value no longer matches the request and let save recompute values
A fetched field stays editable while its link has a valueA user can overwrite a value that the linked record should provideApply the fetched-field disabled rule in both normal fields and grid rows
A field override changes required or hidden state in one client path onlyA form can show the wrong control state or reject a save with a different ruleUse the shared field transformation and mandatory-field checks for rendering and validation
A form is published with a blank hidden required defaultA public submission can fail because the target lead or deal lacks a mandatory valuePublishing validates every hidden required field before it changes state
A form save accepts a field outside the CRM field catalogA public visitor may write an internal or unsupported target fieldValidate visible and hidden fields again on the server and take field types from DocType metadata
Guest select access is granted to an unrelated DocTypeA public form can enumerate records outside its intended link targetsThe grant path limits targets to linkable fields on CRM forms and grants select only
A logged-in form preview leaves the session in the Guest contextThe author can be logged out or lose session data on a later requestRestore the active user and the original session identity and data after the Guest query
A public booking uses stale free-slot data or two requests race for one hostTwo guests can receive the same meeting timeRecheck availability under host and guest locks before creating the booking
A booking’s guest token is exposed or accepted without an upcoming confirmed bookingA visitor can change another booking or alter a finished meetingUse a secret token lookup and reject cancelled or started bookings
A booking creates a record without the form’s hidden defaults or CRM enrichmentA lead or deal can miss its source, status, organization, or contact linkRoute booking-created records through the same form enrichment contract as public forms
Google Calendar fails while a booking or event is being savedA valid CRM booking or event can be lost because an external calendar is unavailableKeep the CRM record and continue without sync, then allow later calendar sync
The notification panel loads an unbounded historyUsers with many notifications can wait seconds for the panelReturn the newest fixed page and use the separate unread count for the badge
A digest runs without a sender or outside the user’s local morning windowThe user receives no useful digest or receives duplicatesRequire an outgoing account, check opt-out and local time, and store one run per local day
An event reminder job runs twice for the same recipientA user can receive duplicate email or realtime remindersClaim a unique reminder marker before sending and retry only failed claims
An event has no custom reminders and FCRM Settings has no matching defaultThe event receives no scheduled reminderConfigure a custom reminder or the matching regular or all-day global rule
An automation event payload or correlation key changes without updating flow metadataExisting Automation Flows can stop matching events or use the wrong subjectKeep event declarations, emitters, subject mapping, and correlation options as one contract
The overdue-task sweep cursor moves past a delayed scheduler windowTasks can miss their overdue automation triggerResume from the saved cursor with the bounded lookback before advancing it
A user changes a record phone number after a WhatsApp conversation existsReplies from the old number stop appearing on the recordRequire explicit confirmation before changing or clearing the recipient number
WhatsApp access is granted without a CRM sales roleA user can reach messaging features outside the CRM role policyApply the WhatsApp role guard before client-facing endpoints
An incoming WhatsApp sender has no match and no append ruleThe message is not linked to a lead or dealConfigure an account append action when new senders must create leads
A WhatsApp account is inactive or the app is not installedThe client can show messaging actions that cannot send or receive messagesCheck installation and active default-account state before exposing WhatsApp actions
A WhatsApp account still has linked records when deletion startsFrappe rejects the delete and the user may not know which records block itUse account usage data for the delete warning and remove or relink all references first
A non-CRM user is needed before the full user fetch finishesThe activity view may show a temporary email-based user nameThe client performs a capped background user lookup and keeps a fallback display record
A user availability status is disabled after a user selects itA user update can refer to a status that no longer appears in the status listValidate enabled status records and publish status-list changes to the desk room
A manager changes a CRM role while the user remains in an invalid sales hierarchy positionRole change can violate hierarchy rules or leave access inconsistentRole updates check hierarchy state and remove or preserve related roles as required
A manager changes roles for a user controlled by a Role ProfileThe saved role change can be rejected or later be replaced by the profileCheck for a Role Profile and change the profile instead
A user without a password is treated as an SSO or LDAP user incorrectlyThe user may receive an unnecessary setup redirect or remain unable to sign in laterCheck stored password state first, then exclude SSO users, LDAP users, Frappe Cloud sites, and sites with disabled password login
An unauthorized user calls set_password or a user with a password repeats first-time setupA credential path can bypass the intended guided setup stateRequire a logged-in session and needs_password_setup() before setting the first password
Onboarding receives a deleted, converted, or unreadable preferred recordThe first-use flow can open a dead or inaccessible lead or dealRecheck record eligibility and access, then fall back to the earliest readable record or return no record

Key files

FileWhy to read it
crm/…/__init__.pyShared translation, invitation, app-access, email-recipient, attachment, and file-upload API boundary
crm/…/doc.pyMain record list, quick-filter, seen-state, view, assignment, relationship, and bulk action boundary
crm/…/command_palette.pyPermission-filtered record search, indexed activity search, recent items, tasks, and response deadlines
crm/…/dashboard.pyDashboard layout, sales metrics, chart choices, access scope, and app chart contribution boundary
frontend/…/Dashboard.vueClient dashboard loading, filtering, layout saving, and reset flow
frontend/…/dashboard.jsClient chart option loading and fallback behavior
crm/…/form.pyCRM form authoring rules, validation, publication, booking-form limits, and public submission enrichment boundary
crm/…/crm_form.pyPublic form route, rendering, link visibility, session-safe preview, and embedding behavior
crm/…/activities.pyAssembly of the lead and deal activity timeline
crm/…/comment.pyComment creation, attachments, and mention notification flow
crm/…/todo.pyAssignment permission, owner mirroring, cancellation, and assignment notification flow
crm/…/email.pyScheduled email cancellation, immediate send, queue locking, and send-time dating
crm/…/whatsapp.pyWhatsApp role access, record linking, notifications, and recipient-change protection
crm/…/session.pyCRM role checks and user and organization data returned to the client
crm/…/availability.pyUser availability validation, category mapping, and realtime status updates
crm/…/user.pyPassword setup checks, password changes, CRM role administration, and Flow User joining rules
crm/…/onboarding.pyFirst-use selection of a readable lead or deal for the onboarding flow
crm/…/crm.pyCRM page boot and redirect for users who must set a password
crm/…/notifications.pyIn-app notification paging, previews, route mapping, and mark-as-read contract
crm/…/digest.pyMorning digest schedule, Home-aligned sections, and email destinations
crm/…/event.pyEvent visibility, Google sync, reminder selection, timing, recipient claims, and delivery
crm/…/booking.pyPublic booking slots, guest booking lifecycle, record linking, calendar sync, emails, and limits
crm/…/events.pyCRM domain events for messages, lead and deal changes, and overdue tasks
crm/hooks.pyServer hooks, automation declarations, and scheduler entries that connect API behavior to document and time events
frontend/…/document.jsShared client resource for record loading, permissions, assignment, save behavior, and linked field values
frontend/…/fetchFrom.jsShared client rules for parsing and locking fetch_from fields
frontend/…/fieldTransforms.jsShared client rules for field metadata, regional state choices, and required-field checks
frontend/…/event.jsClient event, participant, and reminder data path
frontend/…/users.jsClient user loading, caching, and fallback resolution
frontend/…/Activities.vueClient entry point for the activity service
frontend/…/FormBuilderPanel.vueClient entry point for form configuration and publication