Tracking the very last call result of a contact

Forgive me if I'm posting in the wrong spot!

We have an added custom fields for calls that allow a user to select "TT" for Talk To, "LM" for "Left Message",  "Scheduled Call" and "Ops Note". It helps give us a better idea of which clients are picking up the phone vs not. 

My sales director wants me to provide her a report of all of our current clients and their last call result. (not the last call, but the result. LM, TT, Ops Not, etc) This has proven difficult.

In theory, I think I need to create another field and perhaps a workflow that would occur when the record is saved and update the new field with the newest call result. (I already created a workflow that documents that last phone call date/time stamp but now I need a separate field that shows the last call result)


Does anyone have an idea on how I can accomplish this?

Thank you so much!

  • Hi Kayla Ebert 

    It can be easily accomplished through Process Author on ENT or Workflow Definition on PRO.

    Basically you need to create a text field "Last Call Result" on Clients and populate it with the respective field from latest held Call.

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Which edition do you use?

    In PRO you have to define such a field with the customer.

    In ENT you could create an SQL based Advanced Report woith the existing data.

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • Hi Harald Kuske, we have SugarCRM Enterprise, Version 8. I know how to create a text field, but I'm lost when it comes to how to populate it with the respective field from last call. 

  • Hi Andrew. We have SugarCRM Enterprise, Version 8. I know how to create a text field, but I'm lost when it comes to how to populate it with the respective field from last call. 

  • You should be able to do this with an Advanced Workflow.  You said you already did something similar for another field?

    http://support.sugarcrm.com/Documentation/Sugar_Versions/8.1/Ent/Administration_Guide/Advanced_Workflow/index.html 

  • If you only want to copy a field from e.g. calls to e.g.contacts you can create a logic_hook, which is the easies way to write custom code in Sugar.

    See http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.1/Architecture/Logic_Hooks/#Module_Hoo…  for logic_hook documentation.

    The only thing you need is a module hook for module calls.

    So you write a file logic_hooks-php to custom/modules/Calls/  with content like this:

    <?php    
    $hook_version = 1;   
    $hook_array['after_save'][] = array(       
              1,
              'copy code_c to parent contact',
              'custom/modules/Calls/copyCode.php',
              'copyCode',
              'copyCodeFunc',
          );

    Then you create the class module custom/modules/Calls/copyCode.php to execute the code (a simple copy)

    <?php
        class copyCode
        {       
            function copyCodeFunc($bean, $event, $arguments)
            {           
             //logic
                if ($bean->parent_type=="Contacts"){
                   $code = $bean->code_c;
                   $id = $bean->parent_id;
                   $contact = BeanFactory::getBean("Contacts",$id);
                   $contact->code_c = $code;
                   $contact->save();
    //more ...
    //or less
                }
            }   
          }
    ?>

    You can add some additional plausibility check if you want ( e.g $id not empty...).

    If you want to apply it on all participant contacts linked to the call you can add:

    //more ...  
                   foreach ($bean->contacts_arr as $num => $nid){
                      $ncontact = BeanFactory::getBean("Contacts",$nid);
                      $ncontact->code_c = $code;
                      $ncontact->save();
                   }
    //or less

    After Quick Repair and Rebuild the hook should be called and executed

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • Hi Harald,

    We don't have prior experience with logic hooks. It kills me that the solution is now staring at my face, yet I'm at a loss as to my next steps. As we aren't on prem, is this something our Sugar Partner would have to implement or can we do this ourselves?

    Thank you! 

  • Hi Justin,

    I created an advanced workflow where the Target module = calls.

    The start event applies to new records only. 

    I selected Action Type- Change Field. I changed the target module from Calls to Contacts.

    Then I selected the newly created "Test Most Recent Call Result" text field that I created but my custom Call Result field was not available to select. It seems like it should be available. I'm going to reach out to Support and see if anything can be done to make it a useable field in Advanced Work Flow. Fingers crossed!!!!

  • You may not be able to read the value from a Dropdown to place into the other field.  You can use a Gateway to read the value from the Call Dropdown.

    Use the gateway to read the value of the Call Result and move to the correct Action to update the Parent Contact with the correct value.

  • Kayla Ebert The solution provided by Justin Kuehlthau is the best solution with out having to get your Sugar partner to create a Logic Hook. You could even incorporate it into your current workflow where you saved the last call timestamp.

1 2