Duplicate lead/opportunity entities

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • radu
    Junior Member
    • May 2022
    • 11

    Duplicate lead/opportunity entities

    Hello all,

    I'm happy with the base Lead and Opportunity entities, but my CRM needs two different data structure for handling two product process. For one product, the existing Lead+Opportunity are fine, but for the other product process, I need individual entities. The reason behind this that there will be many special fields for the second product, which is relevant only for it, so I don't like the idea of mixing two products inside one Lead+Opportunity process.

    That's why I started to experimenting with cloning the default Lead and Opportunity entities. I'll refer them as original.

    My goals:
    1. I would like to create two new entities for the second product process:
      1. My Lead, which would be cloned from the default Lead entity;
      2. My Opportunity, whichwould be cloned from the default Opportunity entity.
    2. I would like to create the links between them like the originals, so:
      1. The process would be the same as original: I would like to create My Opportunity record from a My Lead record, by converting.
      2. I would like to have the relation (link) between them, like the original ones.
      3. After the conversion procedure, I would like to have set the status of My Lead to Converted, like in the original process.
      4. When I check a My Lead record's details, I would like to see a Converted To side panel, where the related My Opportunity record is linked
      5. When I check a My Opportunity record's details, I would like to see the Original lead field.
    I checked the following topics in the forum:

    Create entity with convert function
    Need a way to duplicate entities and layouts
    How to clone entity from one instance to another


    I also checked the tutorial of eymen-elkum, thanks for it! It's a great inspiration as a base, but unfortunately I failed to follow it, because there are no "SelectManagers" and "Acl" directories inside /application/Espo/Modules/Crm/ - maybe the newest version of Espo changed the structure a little bit...? Hence, I tried to follow the basic principles, here are my results.
    • I started with cloning the original Opportunity to "My Opportunity", in order to test whether I could create a process "Lead -> My Opportunity". (I haven't tried to clone Leads yet.)
    • I managed to clone the Opportinity. A few tries and rebuilds later, I have My Opportunity, which is working (add, edit, list etc.). I made some changes inside the field names and link names inside the php and json files, but I could not make the desired connections, so I can't edit Original Lead at "My Opportunity" details, nor "My Opportunity" link on Lead details pages.
    • I extended the Lead entity's detailConvert file (custom/Espo/Custom/Resources/layouts/Clients/detailConvert.json), like in this topic. I saw tanya's comment, but I thought it's worth a try, 3 years passed since 2019.
    • When I try to use Convert button on a Lead record, it shows "My Opportunity" next to the three original entities (Account, Contact, Opportunity), but after selecting the My Opportunity option, filling and sending the form, this happens: Lead's status changes to "Converted" state, however the data never make itself into "My Opportunity" (so the base data of the record never inserted, I checked even in the database table). The Lead's record page, the Converted To box is green, but showing only the Account, Contact and Opportunity options (all none). I could not find any clue how this box generated.
    If I have to, I will stuck with only one Lead and one Opportunity, but... has anyone managed to clone Lead/Opportunity inside Espo with their full functionality?

    I'm using the latest version of the software.

    Thanks for any advice:

    Radu


  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    I would suggest rather then cloning you could create custom entities (Lead would be a person type entity & Opportunity would be an event type) and then implement functions (you could look how espocrm uses those functions and use them the same way). it would be best way to get desired outcome.
    Rabii
    Web Dev

    Comment

    • radu
      Junior Member
      • May 2022
      • 11

      #3
      Thanks rabii, meanwhile I reached the same conclusion.

      Comment

      Working...