Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Email (email1) field not exporting from custom module

  1. #1
    joeicooper is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    24

    Default Email (email1) field not exporting from custom module

    I've created a custom module that acts much like the Contacts or Leads module. When I export a record or set of records from the module the email address associated with the record is not appearing.

    Looking at /modules/Contacts/Contacts.php I can see that the email fields are joined from another table in the database, and this code doesn't appear in my 'custommodule'.php file at all.

    Is there an easy way to get this email field to export?

    Thanks,

    Joe

  2. #2
    joeicooper is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    24

    Default Re: Email (email1) field not exporting from custom module

    Just a quick bump... anyone have any ideas on the best way to do this?

  3. #3
    joeicooper is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    24

    Default Re: Email (email1) field not exporting from custom module

    No ideas? Another quick bump. Thanks. Joe

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Email (email1) field not exporting from custom module

    What is the version of your SugarCRM instance?

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    joeicooper is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    24

    Default Re: Email (email1) field not exporting from custom module

    v 5.5.4

    Thanks,

    Joe

  6. #6
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Email (email1) field not exporting from custom module

    Quote Originally Posted by joeicooper View Post
    v 5.5.4

    Thanks,

    Joe
    Is this PRO or CE?
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  7. #7
    joeicooper is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    24

    Default Re: Email (email1) field not exporting from custom module

    Sorry... this is CE.

  8. #8
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Email (email1) field not exporting from custom module

    You can implement the function create_export_query into your custom module just like it is on Contacts. Remember you need to replace the words "contacts" by "custom module" or something like that.

    You should not face issue doing that.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  9. #9
    Bobhardyoyo is offline Sugar Community Member
    Join Date
    Mar 2009
    Location
    UK
    Posts
    59

    Default Re: Email (email1) field not exporting from custom module

    I have the same issue initially with v5 which has now been upgraded to v620. What code from the contacts.php do I need to add in and into which file in my custom module folder?

    I have tried to add it into where I think it needs to go but it breaks my module.

    Below is the code from the file I am adding the create_export code to:

    Code:
    require_once('modules/F1000_F1000Contacts/F1000_F1000Contacts_sugar.php');
    class F1000_F1000Contacts extends F1000_F1000Contacts_sugar {
            
            function F1000_F1000Contacts(){        
                    parent::F1000_F1000Contacts_sugar();
            }
            
    }
    ?>
    And this is the code I have extracted from the contacts.php file

    Code:
      function create_export_query(&$order_by, &$where, $relate_link_join='')
            {
                    $custom_join = $this->custom_fields->getJOIN(true, true,$where);
                            if($custom_join)
                                    $custom_join['join'] .= $relate_link_join;
                             $query = "SELECT
                                    contacts.*,email_addresses.email_address email_address,
                                    accounts.name as account_name,
                                    users.user_name as assigned_user_name ";
                                                    if($custom_join){
                                                               $query .= $custom_join['select'];
                                                     }
                                                     $query .= " FROM contacts ";
                             $query .= "LEFT JOIN users
                                            ON contacts.assigned_user_id=users.id ";
                                 $query .= "LEFT JOIN accounts_contacts
                                            ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))
                                            LEFT JOIN accounts
                                            ON accounts_contacts.account_id=accounts.id ";
    
                                                    //join email address table too.
                                                    $query .=  ' LEFT JOIN  email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module=\'Contacts\' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 ';
                                                    $query .=  ' LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id ' ;
    
                                                    if($custom_join){
                                                              $query .= $custom_join['join'];
                                                    }
    What else do I need to do?
    Version 5.5.1
    PHP 5.3.8
    MySQL 5.5
    IIS 6 Windows 2003 R2 SP2

  10. #10
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Email (email1) field not exporting from custom module

    The code from Contacts 100% refers to contacts table, you need to update it to refers to your module.
    You only need to copy/update that function.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 2011-10-12, 01:37 AM
  2. Replies: 1
    Last Post: 2010-04-26, 02:38 PM
  3. No Email address field while exporting
    By shamimwilson in forum Help
    Replies: 0
    Last Post: 2009-03-30, 11:47 AM
  4. One custom field is not exporting
    By DN667 in forum Help
    Replies: 0
    Last Post: 2008-10-10, 07:14 AM
  5. Replies: 0
    Last Post: 2006-10-03, 03:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •