Frappe CRM
CRM tracks sales in two documents. A CRM Lead is a prospect that is not yet qualified. A CRM Deal is a qualified opportunity, usually made by converting a lead. Every step here is a document read or write, or a whitelisted method, so it works the same from the site's assistant, MCP or frappectl. Each user sees the leads and deals that their roles and the sales hierarchy allow.
1. Data model
CRM Lead: a person (first_nameis required) and anorganizationname as text. Alsoemail,mobile_no,status,lead_owner,source, andconverted(1 after conversion).CRM Deal:organizationlinks to aCRM Organization. Thecontactstable linksContactrecords, with one markedis_primary. Alsostatus,deal_owner,deal_value,expected_deal_value,expected_closure_date,probability, andlead(the source lead).CRM Lead StatusandCRM Deal Status: each site defines its own statuses. Read them first. Thetypefield gives the meaning:Open,Ongoing,On Hold,WonorLost.CRM Organizationholds companies.Contactholds people, with emails inemail_idsand phones inphone_nos.FCRM Note(title,content) andCRM Task(title,status,priority,assigned_to,due_date) link to a lead or deal throughreference_doctypeandreference_docname.CRM Call Logrecords calls. Itsreference_doctypeandreference_docnamepoint to the lead or deal.
2. Operations
- Convert a lead: call
crm.fcrm.doctype.crm_lead.crm_lead.convert_to_dealwithlead. It makes the deal, contact and organization and marks the lead converted. It returns the deal name. Passif_converted: "Return Existing"to get the existing deal on a retry instead of a second deal. - Read a timeline: call
crm.api.activities.get_activitieswithname(a lead or deal). It returns field changes, emails, comments, calls, notes, tasks and attachments. - Change deal contacts: call
add_contact,remove_contactorset_primary_contactincrm.fcrm.doctype.crm_deal.crm_deal, each withdealandcontact. - Add a comment: call
crm.api.comment.add_commentwithreference_doctype,reference_nameandcontent(HTML). - Send an email: call
frappe.core.doctype.communication.email.makewithdoctype,name,recipients,subject,contentandsend_email: 1. - Assign an owner: set
lead_ownerordeal_owner. CRM then shares the document with that user and assigns it to them. - Create a lead from a call: call
crm.fcrm.doctype.crm_call_log.crm_call_log.create_lead_from_call_logwithcall_logandlead_details.
3. Traps
- Do not make a deal from a lead's data yourself. Use
convert_to_deal, or the lead stays unconverted and loses its link to the deal. - A lead with a
Loststatus cannot be converted. - A
Loststatus needslost_reason. Whenlost_reasonisOther,lost_notesis also required. - Forecasting can make deal fields mandatory. When it is on in
FCRM Settings, every deal save needsexpected_deal_valueandexpected_closure_date. - Statuses are site data. Do not assume
New,QualifiedorWonexist. Read the status doctypes.