Page 1 of 3 123 LastLast
Results 1 to 10 of 23
Like Tree1Likes

Thread: Auto-filling fields

  1. #1
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Auto-filling fields

    Using Sugar CE 5.2

    Hello, I want to put a bunch of new fields (read only) of account (like adress, email, zip code) in a custom module, and once I fill the name of the account it will bring all the info related and complete the other fields.

    What I dont know how to do is the autofill process once the main field (account name) is imputed.

    Can anyone help me?

  2. #2
    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: Auto-filling fields

    Hi Leo

    You may add a code like that

    PHP Code:
                'displayParams' =>
                array (
                  
    'field_to_name_array' => array(
                    
    'id' => 'accounts_tenyaccounts_ida',
                    
    'name' => 'accounts_test_company_name',
                    
    'billing_address_street' => 'billing_address_street',
                    
    'billing_address_city' => 'billing_address_city',
                    
    'billing_address_state' => 'billing_address_state',
                    
    'billing_address_country' => 'billing_address_country',
                    
    'billing_address_postalcode' => 'billing_address_postalcode',
                    
    'website' => 'website',
                    
    'phone_office' => 'phone_office',
                    
    'phone_fax' => 'phone_fax',
                    
    'phone_alternate' => 'phone_alternate',
                    
    'employees' => 'employees',
                    
    'annual_revenue' => 'annual_revenue',
                    
    'industry' => 'industry',
                    
    'account_type' => 'account_type',
                  ),
                  
    'additionalFields' => array(
                    
    'website' => 'website',
                    
    'phone_office' => 'phone_office',
                    
    'phone_fax' => 'phone_fax',
                    
    'phone_alternate' => 'phone_alternate',
                    
    'employees' => 'employees',
                    
    'annual_revenue' => 'annual_revenue',
                    
    'industry' => 'industry',
                    
    'account_type' => 'account_type',
                  ),
                  
    'billingKey' => 'billing',
                  
    'shippingKey' => 'shipping',
                ), 
    into field defs on custom/modules/<ModuleName>/metadata/editviewdefs.php

    Cheers
    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.

  3. #3
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Auto-filling fields

    Hey Andre, thanks for replying, just a bit confused, where is the main field on the code?That would show the dependence? In my case the account name, that once is filled will complete the others fileds.
    Second, what are field_to_name_array and additionalFields on the code?
    Another question, the fields on the custom modulo must be related type?
    Last edited by leowolff; 2009-05-20 at 12:24 PM.

  4. #4
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Auto-filling fields

    Let me put a simple code example:

    PHP Code:
      'LBL_PANEL_CONTACT' => 
          array (
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'company',
            
    'displayParams' => 
                array ( 
    'website' => 'website'
                  ), 
                
    'label' => 'LBL_COMPANY',


              ), 
    What should I change to just show the website?

  5. #5
    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: Auto-filling fields

    field_to_name_array will manage the fields to be automatically filled in when selecting a record from popup. Inside this array, the key represents the name of the field into source module (module into popup) and the value represents the field name into target module (module in editview).
    additionalFields will manage the fields to be automatically filled in when selecting some record from ajax auto-completion.

    Cheers
    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.

  6. #6
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Auto-filling fields

    So far so go, I made a few fields to work, thanks Andre.

  7. #7
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Auto-filling fields

    Hello Andre, could you enlight me the right place to fit the code?

    PHP Code:
        'LBL_PANEL_CONTACT' => 
          array (
            
    => 
            array (
              
    => 
              array (
                
    'displayParams' => 
                array ( 
                  
    'field_to_name_array' => array( 
            
    'name' => 'company',
                
    'billing_address_street' => 'billing_address_street_c',
                
    'razaosocial_c' => 'razaosocial_c',
                
    'website' => 'website_c',
            ),
            ),
            
    'name' => 'company',
                
    'label' => 'LBL_COMPANY',
              ),
              
    => 
              array (
                
    'name' => 'website_c',
                
    'label' => 'LBL_WEBSITE',
              ),
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'razaosocial_c',
                
    'label' => 'LBL_RAZAOSOCIAL',
              ),
              
    => 
              array (
                
    'name' => 'billing_address_street_c',
                
    'label' => 'LBL_BILLING_ADDRESS_STREET',
              ),
            ),
          ), 
    Becuase right now I am getting an error on account name.

  8. #8
    johnius is offline Junior Member
    Join Date
    May 2009
    Posts
    1

    Default Re: Auto-filling fields

    This is exactly what I want Sugar to do for me. I know absolutely nothing about coding, how to edit the .php files, or even where they are stored. I am also wondering if I can put a twist on this: I work in aviation. Every airport has at least one fuel vendor and some have more. I want to input the airport name and have options for that airport's fuel vendor in a drop down and have the drop down auto fill the contact details for that vendor. I would also like this to update in real time from the database (e.g. I am going to an airport I have not been to before, I want to be able to input the airport name and all information onto the same page I'm currently viewing or a new vendor opens and I need to add them to my vendor list for that airport).

    Thanks for your help.
    John

  9. #9
    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: Auto-filling fields

    Hi Leo

    Note the the account_name field is dupped.

    Cheers
    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.

  10. #10
    leowolff is offline Sugar Community Member
    Join Date
    Apr 2009
    Posts
    126

    Default Re: Auto-filling fields

    Hello, just to let everyone knows, the function 'field_to_name_array' calls the file custom\modules\<Module>\metadata\popupdefs.php. So if you want to autofill a field from another module it must be in that file too, if its not there it will not bring it.

    My problem was that I was unable to bring onwership, phone_office, website from account module. So I went to popupdefs.php and I add the the fields that I wanted to bring, like this:

    'OWNERSHIP' => array(
    'width' => '10',
    'label' => 'LBL_OWNERSHIP',
    'default' => false,
    ),

    and it worked. I hope this info wil help more people out there.

    Regards

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to ger fields from ajax auto-complete
    By andopes in forum Feature Requests
    Replies: 1
    Last Post: 2010-10-04, 07:20 AM
  2. Auto filling fields using calculation.
    By user21 in forum Help
    Replies: 3
    Last Post: 2009-03-05, 12:04 AM
  3. Auto filling of EditView items from popup
    By webnetin in forum Help
    Replies: 0
    Last Post: 2008-10-27, 01:19 PM
  4. Email Templates Still not Filling Fields
    By monkeyfish in forum Help
    Replies: 3
    Last Post: 2008-07-16, 06:52 PM
  5. Automaticly filling of custom fields
    By blooberi in forum Developer Help
    Replies: 0
    Last Post: 2008-06-26, 02:38 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
  •