Leads, Prospects, Contacts, and Customers?

I’m trying to understand the ERPNext CRM. I’m coming from working with SuiteCRM, which is typically set up with Targets, Leads, Contacts, and Accounts.

As I understand it, in ERPNext:
Lead: A record of a person/company (might just be a company name without an actual person’s name or detaisl) that might buy from me.
Contact: A person, which might the decision maker that actually buys the products
Prospect: A company that might buy something from me
Customer: A record of a person/company that bought something from me.

So, the Sales team would probably mostly be working from Lead, Prospects, and Opportunities records. If a Lead is qualified, or at least verified to be a real entity, the Business is converted into a Prospect.

One problem I see is that if a Lead is converted, there’s both a Lead and a Contact record. The Contact record might have different data that references the same person, just stored in two different records…

So, since Lead and Contact records (referring to the same human) can be updated independently, reps might have to refer to 2 different records to be sure they’re not missing anything…

Contact is a loosely coupled object. Typically a one-to-many relationship document.

Imagine if a Lead is an organisation.
You would have to deal with multiple contacts from the organisation(Lead) say CTO, CFO or your channel partner to work with. In this case you create multiple contacts and associate with the lead.

This holds true for your customer also.

Moreover Director of one organisation can be CTO of other organisation. In this case a contact is not created again. Just contact will be assigned to the organisation.

If a Lead Record (which contains both the organization, and a person/decision maker) is converted to a Prospect, is it best to just stop using the Lead record, and then only update the Contact record?

If I create a Prospect from a Lead, I am left with a Prospect (for the organization), a Lead (containing both the “Person” and the Organization), and a Contact (the person).

This would seem to make the process of updating records prone to mistakes, or at least make it easy to miss relevant data related to different people/organizations. For example if a rep creates as ToDo/Event/Email for Contact record, he won’t see it if he only looks at the Lead record…

You have to initiate communications, events from Leads/Prospects/Opportunities/Quotations
Not directly from contacts.
From V14 All the communications will be carry forwarded to subsequent documents. If you have created a Prospect from Lead, all the communication with respect to Lead will be carry forwarded to the Prospect. You don’t have to come back to Lead for communication records.

This is a very valid concern. One I am dealing with this afternoon. Because the data doesn’t stay synchronized, I am forced to write code to perform that synchronization. (had to do something similar last year, for 'Contact' and 'Customer')

However, I’m also facing a 'Lead'-specific challenge this time (Version 13, btw):

  • Lead has a single field named “Person Name”.
  • Contact has both “First Name” and “Last Name” fields.
  • When you create a Lead, it automatically creates a Contact.
    • How does it know how to transform 1 “Person Name” into “First Name” + “Last Name”? Answer = there is a simple formula/algorithm that performs the string-splitting.
    • However this formula will often be incorrect for people with multi-word First or Last names. :slightly_frowning_face:

So…need to fix that too. Either adding 2 new fields to 'Lead'. Or making its “Person Name” read-only, and driven by the Contact data. Haven’t decided yet.

:fork_and_knife:

2 Likes

I don’t really understand the concept of contact customer and prospect.

I understand that contacts are the singular such as an individual at a company (when the company is the customer)

In a b2b scenario that’s fine, though we mostly only deal with one person at a company.

In a b2C scenario it makes sense to just have a customer.

Apart from this I have no idea what a prospect is used for.

I understand it’s the equivalent of an opportunity but for the company but it makes it very complicated and unnecessary to have the functionality.

I wouldn’t mind if you could disable the doctype but for some reason I can’t. I assume it’s a master.

I can’t even hide the buttons correctly on the uk with client scripts.

A challenge with ERPNext (and many other ERPs), is trying to be “One Size Fits Most”. To create a set of DocTypes that meet the needs of as many customers as possible. Without becoming too specialized.

I’ve often encountered ERPs with CRM concepts such as Lead, Opportunity, Prospect, Campaign, etc.
However, rarely do I meet customers who want to use 100% of these features. But some do, so ERPNext has the building blocks to support them.

Prospect is a step halfway between Lead and Customer.

  • Leads could be unqualified. I could give you a phone number, 555.123.4567, and tell you "this is a lead for sales". You know nothing yet, besides this piece of information.
  • Prospect is more than that. Perhaps you called the number, spoke to a person, and discussed your business. They seemed interested. But so far, they have not bought anything from you. So not a Customer yet.

A single Contact can be associated with any, or all of these.

  • Contact A → points at Customer CUST-0002334.
  • Contact A —> points at Lead LEAD-0009333.
  • Contact A —> points at Prospect PSP-02024.

Same human, just different relationships.

To hide these DocTypes, you could alter the Roles and Role Permissions. Make sure that no one has access to see them.

1 Like

Thank you for taking the time to write a detailed post,

I understand, propect is a holder for all the tasks, emails, meetings etc that relate to the lead, opportunity and customer modules,

I agree with you about one size fits most because alot of the work is stripping back alot of the functionality. I am busy customizing the erp for my company. Im trying to build alot of the automations with client side scripts.

Do you know where i can get a list of these things

frm.add_custom_button
frappe.ui.Dialog

  1. fieldname_add

Also i am adding custom buttons to my form Attached pin.

removing the create button seems to break the activities tab in the lead fform.

could you also point me towards an article that can help me understand how to build automations with client side scripts,

IE) on button press

create opportunity
add task
send email

Here’s some of the Official Documentation:

If you are experienced and lucky, this might be enough to help you. However, the documentation never really helped me. I had to teach myself by studying examples.

The JS code for the 'Lead' DocType is actually a really great beginning. If you study this code, it demonstrates how to:

  • Add custom buttons
  • Teach your buttons to call other JS functions.
  • Teach your JS code to call Python serverside code.
  • How to create a Dialog widget.

Link to Lead DocType JS code: (erpnext/erpnext/crm/doctype/lead/lead.js at develop · frappe/erpnext · GitHub)

This won’t explain everything. But some things you can skip right now.

For example, there is not a comprehensive explanation of the purpose and differences between the 'setup', 'before_load', 'on_load', 'refresh', and 'onload_post' methods.

Or why sometimes this syntax is used:

erpnext.LeadController = frappe.ui.form.Controller.extend({
  ...
}
extend_cscript(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm }));

…but other times this syntax:

frappe.ui.form.on("Lead",  {
...
});

…but sometimes both simultaneously.

Even after 6 years, I still don’t really understand some of it. Perhaps if my programming background was in Flask or Django, I wouldn’t struggle as much. :man_shrugging:

However, you can achieve “good enough” by examining the standard code, copying and pasting components, and altering for your own needs.

And whenever we have doubts, well…there’s always console.log(); :slight_smile:

1 Like

From what I’ve learned in using ERPNext is that “Prospect” is similar to what most CRMs call “Accounts.”

A Prospect doesn’t represent a specific person you’re trying to sell to, but rather an entity. In a standard Business-To-Consumer transaction, the Prospect might be just one person. For example if I sell candles, there’s probably only one person involved in that buying decision.

In most Business-To-Business scenarios, the Prospect is really the business, itself. That Prospect might have several Leads and Contacts associated.

In something like a real estate transaction, the Prospect might be a family of people, as in a husband and wife couple. Since both the husband and the wife have to sign the home purchase documents (typically) it’s useful to have both people linked together as a Prospect.

Hey Brian,

Again thank you for the awesome reply, Being somewhat an amatuer with scripting i tend to be able to get myself around if i have a list of “what stuff is & what stuff does” if you know what i mean,

My first ever succesfull coding was in a very specific obscure language that was designed for a virtual instrument called kontakt. So it was somewhat similar to frappe in the sense that you would have seperate scripts that each call on each other for different puposes,

the gui script
the audio script
the functions script

Im sure you get the just, ill leave a link if you are interested to have a read.
They also had a tiny community where there where probably only 30 develeopers releasing commercial products.


Back to frappe.

I understand the concept of a python back-end and a JS front end.
In my mind im going to be using server side scripts to run my automations
(Assign tasks, Send Emails, Automate Reports Automate Workflows).

Then i will use JS to pretty much make buttons to simplify the user interface for my team.

Again the “catch all” approch with a platform as you said resukts in me not understanding half of the concepts, but also me having to strip these things back as much as possible.

What i am busy working on now,

Simplifying the lead form with single buttons (Image attached)

Successes:

  • Ceated Buttons
  • Removed “Create” and “Action”

Objectives:

  • Only Remove Prospect from create
  • Remove Action

Problems:

  • Code adds Buttons
  • Code removes both create and action completely
  • Removing create an action breaks activity tab in lead form

I will post an image and the code

frappe.ui.form.on('Lead', {
    refresh(frm) {

        // Add the 'Add Task' button
        frm.add_custom_button(__("Add Task"), function(){
            console.log("Add Task button clicked");
        });

        frm.add_custom_button(__("New Opportunity"), function(){
          console.log("Clicked")
      }); 
  
      frm.add_custom_button(__("Add Meeting"), function(){
            console.log("Clicked")
      });  

        // Add the 'Send Email' button
        frm.add_custom_button(__("Send Email"), function(){
            console.log("Send Email button clicked");
        });

        var bt = ['Customer', 'Opportunity', 'Quotation', 'Prospect']
        bt.forEach(function(bt){
            // frm.page.remove_inner_button(bt, 'Create')
            frm.page.remove_custom_button(bt, 'Create');
  
          });
    }
});


Thank you for pointing me to

I am assuming that i will find the relevant "info: in the same folder structure for other doctypes and forms.

are these functions

frm.add_custom_button

Also dotted over the repository or is there solid docs for it?

Also out of interest sake what do you do?, also out of interest sake would you be keen to collaborate with me to build a snippet/script library. Either for gratis or maybe we can make it a plugin for erp next. I am going to be writing alot of these little scripts.

EDIT: Sorry if i sound illiterate but dont have the time to spell check HAHAHA

Hey Bro,

I come from a zoho background so that makes alot of sense, but then my question is whats the point of the contact and customer.

Normal CRM:

Lead —> Opportunity ----> Contact(Contact at Company) and Account(Used for Company)

ERPnext:

Lead -----> Opportunity(Contact Created as well) --------> Prospect ------> Customer.

Lets not forget the other doctypes

Company

So either i need to remove Opportunity from lead and use the prospect as a wrapper, or i need to remove prospect?

what are you thoughts?

Hey Brian,

Can I ask you how you found this symbols thing in github, its flipping awesome, thats what i needed

Actually in ERPNext, a Contact is created when you create a Lead, even if you never convert them to an Opportunity.

A Contact in ERPNext represents a person (Or maybe just the name of a business), but without any context. As an analolgy, think of Contacts in ERPNext like contacts stored in your phone. You have some contacts in your phone that are customers/clients, but you also have friends, family, your barber shop, and the guy that you bought that boat from 8 years ago.

The Customer record is typically used moreso by the customer service/accounts receiveable departments than by sales. The idea behind the Customer record is that it’s used to keep records of AFTER the sale has taken place. As such, you don’t always see Customer records in other CRMs, because CRMs are often just designed to accommodate the sales department, and not customer service/accounting. In ERPNext, your customer service department might not ever touch Leads/Opportunity records, and your customer service/billing departments might not ever work with Lead/Opportunity records.

By default, In ERPNext it will typically work like this:

Lead Generated (trade show, marketing campaign, whatever) → Sales rep talks to Lead → If the Lead is somewhat qualified to buy, create Prospect (maybe link some other decision makers to the Prospect, too) → If an opportunity to make a sale exists, create an Opportunity. → follow up on opportunity until deal closes → Customer record is created.

A Company is something else entirely, and is actually for keeping track of YOUR company, not the customer’s. You can have multiple Companies in your ERPNext. For example, suppose you have an insurance company and a real estate brokerage. You might want to use the same ERPNext instance, but it’s like imperative to keep separate accounting books. So, your insurance company and your real estate brokerage can share Leads/Contacts/Whatever inside ERPNext, but the books can be kept segregated (for tax/regulatory purposes, and for performance/profitability analytics).

2 Likes

Here’s a screenshot of how to open the symbols:

There’s also an option to open it automatically on click:

They’re definitely all over the repositories. Here’s the official documentation for ‘add_custom_button’

Warning that for List Pages, it’s a bit different. For those you’ll want to use 'add_inner_button()'.
However, there is no “outer button”. Not sure why. :man_shrugging:

If “Prospect” is a qualified lead then what is the point of having the “qualification status” and “qualified by” fields in the Lead doctype?

Well, the term “qualified” means different things to different people. Some organizations may choose to convert a Lead to a Prospect if they have a valid Opportunity that might close. Other organizations may choose to convert the Lead to a Prospect once they’ve determined that the Lead actually represents a real person or entity that can buy from them.

From what I can tell, the Qualifcation Status and Qualified By Fields aren’t actually tied to any specific functions within ERPNext, so you could always just disregard those fields if you don’t find them useful.

How I use is as follows:
Lead created > Sales rep contacts Lead > If Lead is unqualified for some reason, the Sales Rep updates the “Qualified By” and “Qualified On” fields. That way, I can generate a report of Leads that have been disqualified within specific date ranges, which is useful to know when to reach back out to that lead again.

1 Like

I’m on v15. There is a checkbox in CRM Settings that blocks the creation of contacts when adding leads. This is helpful for me, because I use contacts as my companies centralized Contacts book.

1 Like

v15.17
I set Auto Creation of Contact : N on all installations.

That means that a Contact has to be created manually, avoiding the probability of having a separate Contact evolved from the Lead / Opportunity detail differing from a bona fide Contact.

With regard to a Prospect:
1 Gartner says a Prospect is a potential customer who has been qualified as meeting specific criteria that indicate an ability and likelihood to buy.
2 Hence hinting at a B2B type of stage after Opportunity but before Customer
3 A Prospect can be linked to multiple Leads and Opportunities
4 Hence it’s actually a B2B step in between an Opportunity / Quotation and a Contract / Customer