Announcement

Collapse
No announcement yet.

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

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

  • 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?

  • #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


    • #3
      thank you very much for your help

      Comment


      • #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...
        X