Results 1 to 3 of 3

Thread: Logic Hook after relate field selected

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

    Default Logic Hook after relate field selected

    Hello, I am using the standard case module that is related to accounts, I have created a third module that I will call contract that is related one - to - one with accounts.

    What I want to do is, on the edit view of cases, after I select one account I want to bring one field of the contract module (related to the account selected) and populate another field on the editview.

    I have tried with field_to_name_array and with logic hook, but no sucess so far. Any idea how to do it?


    Regards,
    Regards,

    SugarCRM CE v.5.2.0c
    Windows platform
    MySQL v.5.0.37
    phpMyAdmin - 2.11.2.2
    Apache Server v.2.0

  2. #2
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Default Re: Logic Hook after relate field selected

    Hello leowolff, you can do using javascript

  3. #3
    garciasanchezdaniel's Avatar
    garciasanchezdaniel is offline Sugar Community Member
    Join Date
    Aug 2011
    Location
    Spain
    Posts
    403

    Wink Re: Logic Hook after relate field selected

    In your editviewdefs.php:

    PHP Code:
    'includes' => 
          array (
            
    => 
            array (
              
    'file' => 'modules/Cases/Case.js',
            ),
            
    =>
            array (
              
    'file' => 'custom/modules/Cases/testing.js'//you include testing.js file that you're going to create
            
    ),
               ... 
    in editviewdefs.php (you search your relate field):

    PHP Code:
    ....
    'panels' => 
        array (
          
    'lbl_cases_information' => 
          array (
            
    => 
                 ......
    ANOTHER FIELD

                 
    ....
                  
    => 
              array (
                
    'name' => 'relate_field',
                
    'label' => 'LBL_RELATE_FIELD',
                
    'displayParams' => array('field' => array(
                         
    'onBlur' => 'testing(THE OTHER FIELD)'//you call your javascript function passing the other //field you want to modify its value
                   
    )
              ), 
    your javascript function:
    Code:
    function testing(field) {
             field.value = "This is other value of your field"; 
             alert("Value changed");
    }
    Good luck
    Daniel

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 2011-10-26, 07:37 PM
  2. Fill related field in logic hook
    By fmarambio in forum Help
    Replies: 4
    Last Post: 2011-07-01, 01:05 AM
  3. Logic hook to update field from another table
    By cmcassity10 in forum Developer Tutorials
    Replies: 0
    Last Post: 2010-04-16, 09:15 PM
  4. Logic hook, relate new bug
    By cmacholz in forum Developer Help
    Replies: 2
    Last Post: 2009-12-15, 02:17 PM
  5. Getting field name of relationship for logic hook
    By jhermiz in forum Developer Help
    Replies: 1
    Last Post: 2008-12-16, 03:44 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
  •