Announcement

Collapse
No announcement yet.

Convert Lead to Opportunity - Transfer History

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert Lead to Opportunity - Transfer History

    Hello,

    I'm fairly new to the CRM and was wondering if someone has an existing module or workflow that would move over history (specifically linked emails) into an opportunity once converted. Often, the lead turns into a single opportunity where we want all history transferred.

    Thanks!

  • #2
    Hi,

    I created an extension to copy the Notes
    Extension to copy Lead stream notes to the converted entity (Account/Contact/Opportunity). - Kharg/copy-lead-notes


    I may consider adding this functionality to duplicate the history to the converted entity depending on the difficulty of the task

    It may be more difficult for emails.

    Comment


    • #3
      Hi Kharg,

      Thanks for the reply and for the creation of extension.

      I actually have the extension installed previously but haven't had any luck with it working.

      Is there anything special to get it activated and working? In the extension settings, the "copy to" is checked off already.

      Comment


      • #4
        You have to check it on to enable the extension.

        it will transfer only newly converted records, not for past conversions.

        Comment


        • #5
          Thanks.

          Curious to know everyones workflow... from lead to opportunity.

          Many conversations start as lead and then goes to opportunity but history stays with lead.

          What does everyone do?

          Comment


          • #6
            teetech,

            Workflow is based on this post: https://forum.espocrm.com/forum/gene...7603#post97603. And if you wish, you can change the Conditions, but this example is about Manual.

            Note that emails can only have one Parent. That is, emails will be in the history of either leads or opportunities from which you converted them.

            You need to create a Workflow with:

            Click image for larger version  Name:	image.png Views:	0 Size:	37.7 KB ID:	101538

            Actions: Execute Formula Script
            Code:
            $leadId = workflow\targetEntity\attribute('id');
            $opportunityId = workflow\targetEntity\attribute('createdOpportunit yId');
            $opportunityName = workflow\targetEntity\attribute('createdOpportunit yName');
            
            $leadsEmailIds = record\findRelatedMany('Lead', $leadId, 'emails', 10000, 'createdAt', 'desc');
            
            $emailsCount = array\length($leadsEmailIds);
            
            $i = 0;
            while ($i < $emailsCount) {
            
            $emailId = array\at($leadsEmailIds, $i);
            record\update('Email', $emailId,
            'parentType', 'Opportunity',
            'parentName', $opportunityName,
            'parentId', $opportunityId);
            
            $i = $i + 1;
            }
            Last edited by victor; 01-12-2024, 02:36 PM.

            Comment

            Working...
            X