Jump to content


Photo

How to make a "Contact or Lead" field inside my custom Module?

relation custom contact lead

  • Please log in to reply
1 reply to this topic

#1 Asaa

Asaa

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationQC, Canada

Posted 20 August 2014 - 09:04 PM

Hi,

To put you guys in context, I have a new module called Calls which is working fine, my module model as some relations

'relations' => array(
          'account'          => array(RedBeanModel::HAS_ONE,  'Account'),
          'contact'          => array(RedBeanModel::HAS_ONE,  'Contact'),

and in my edit view I have the fields to select an Account and a Contact.

If I hit the contact section I can see all contacts registered in my Zurmo but not the leads.

Contact and leads share the same model, but my guess is that there is some kind of fieldType I must put to see all leads and the contacts in that field. or maybe not XD that's what I'm trying to figure out here. 

The field in question exist in the Note portlet, can't seem to figure out how that particular field is generated to access both the leads and contacts. 

 

ty in advance!



#2 Asaa

Asaa

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationQC, Canada

Posted 21 August 2014 - 02:04 PM

After an hour of digging found what I was looking for, I was using the wrong element type.

This is what i was using in my CallsEditAndDetailsView.php
 

                                                                        
    array(                                                                    
        'elements' => array(                                                  
            array('attributeName' => 'contact', 'type' => 'Contact'),
        ),                                                                    
    ),                                                                        

Turns out the Contact element type refers strictly to contact with states that only apply to Contacts and not leads.

The type I should I've been using is :
 

 array(                                                                    
     'elements' => array(                                                
         array('attributeName' => 'contact', 'type' => 'AllStatesContact'),
     ),                                                                    
 ),  

The type "AllStatesContact" refers to all contacts of any states so it also includes the leads.

For those who still haven't figured out yet Contacts have state which are reffered as:

  1. New
  2. In Progress
  3. Recycled
  4. Dead
  5. Qualified
  6. Customer

The choice of the contact state define the if the contact is treated as a Lead or a Contact.

If the state is defined as one of the 4 first types, the contact model is treated as a Lead, as for the other 2 the contact model is treated as a Contact.

Well I hope all this time I took to figure this out might help someone!   :D







Also tagged with one or more of these keywords: relation, custom, contact, lead

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users