I have problem with transforming "Lead" into "Account".

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lukasz412
    Member
    • Sep 2016
    • 50

    I have problem with transforming "Lead" into "Account".

    I have problem with transforming "Lead" into "Account". When i directly add new "Account", there is error 409 and copy is not added, everything is ok. The problem is when i want to transform "Lead" into "Account" ("Account" card already exist), there is no error 409 and "Lead" is transforming into "Account". Is there any solution for this?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hi
    try to override method convert in Lead Service (create in /custom/Espo/Custom/Services a file Lead.php)
    Code:
    namespace Espo\Custom\Services;
    
    class Lead extends Espo\Modules\Crm\Services\Lead
    {
    after file creation Rebuild the system

    instead of
    Code:
        $account = $entityManager->getEntity('Account');
        $account->set(get_object_vars($recordsData->Account));
        $entityManager->saveEntity($account);
        $lead->set('createdAccountId', $account->id);
    use
    Code:
        $account = $this->getRecordService('Account')->createEntity(get_object_vars($recordsData->Account));
        $lead->set('createdAccountId', $account->id);
    Hope, it works

    Comment

    • lukasz412
      Member
      • Sep 2016
      • 50

      #3
      thank you very much for your help

      Comment

      • kanoriuta
        Junior Member
        • Jan 2017
        • 11

        #4
        Hello,

        PHP Code:
          class Lead extends Espo\Modules\Crm\Services\Lead 
        

        had to be changed into

        PHP Code:
          class Lead extends \Espo\Modules\Crm\Services\Lead 
        

        Comment

        Working...