Results 1 to 4 of 4

Thread: Accessing main module's values in subpanel

  1. #1
    hadoob024's Avatar
    hadoob024 is offline Sugar Community Member
    Join Date
    Mar 2010
    Posts
    137

    Default Accessing main module's values in subpanel

    Hello. I'm new to SugarCRM. Read through the tutorial here and have just been given my first assignment. It's going well, except I can't figure out one thing. We have a main module called "Carriers". This module has a subpanel called "Manufacturers". When I'm creating a new record in "Manufacturers", I want to include the record number of the "Carriers" module as a field to be stored in my "Manufacturers" module, but can't figure this out for the life of me. Any thoughts on this? All the tutorials never showed how to do this, but it seems like a basic thing to me. Thanks!

    -edit-
    Duh. Never mind. Lightbulb just went off. Thanks anyway.
    Last edited by hadoob024; 2010-03-03 at 12:59 AM. Reason: Solved my own problem

  2. #2
    mapm's Avatar
    mapm is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Portugal
    Posts
    239

    Default Re: Accessing main module's values in subpanel

    You can create a relate field to do this or some kind of relation in the relationships tab, but first, I think, you need to install booth modules...
    --
    Mário Pereira Martins

    Javali - Administração e Desenvolvimento de Sistemas Informáticos, Lda.
    Madan Parque Edifício VI Campus da FCT/UNL
    Quinta da Torre 2829-516 Caparica Portugal
    Phone: +351 212949666 Fax: +351 212948313
    http://www.javali.pt

  3. #3
    hadoob024's Avatar
    hadoob024 is offline Sugar Community Member
    Join Date
    Mar 2010
    Posts
    137

    Default Re: Accessing main module's values in subpanel

    Thanks. I think a lightbulb went off and I kind of realized that's how values are calculated and how information is passed back and forth between modules. Here's what I've done so far. I've created both modules and they're working fine. In my Manufacturers subpanel's vardefs file, I've created a carrier_id (of type id) field, a carrier_name (of type relate) field, a carriers (of type link) field. And then in the relationships array I created man_carrier field where for the LHS values, I used Carrier, carrier and id. And for the RHS values I used Manufacturers, manufacturers and carrier_id. The relationship type is "one-to-many". Does that seem right so far?

    I guess my next question is where to actually get carrier_id populated? Is it done in editviewdefs.php (if so, how?)? Is it done in my view.manufacturers.php view (if so, how?)? Thanks.

  4. #4
    hadoob024's Avatar
    hadoob024 is offline Sugar Community Member
    Join Date
    Mar 2010
    Posts
    137

    Default Re: Accessing main module's values in subpanel

    Sweeeeet. I figured it out. I went into view.edit.php and basically added the following bit of code:

    PHP Code:
    $this->ev->fieldDefs['carrier_id']['value'] = $_REQUEST['parent_id']; 
    Now that value seems to be populating properly.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2009-09-17, 03:50 AM
  2. Warning: main() [function.main]: open_basedir restriction in effect.
    By netgene in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-02-09, 01:33 PM
  3. Adding a SubPanel to a Module's List View?
    By rickcrites in forum Developer Help
    Replies: 2
    Last Post: 2006-11-05, 01:11 PM
  4. Replies: 0
    Last Post: 2006-10-27, 10:57 PM
  5. Accessing Form Values
    By debon in forum Developer Help
    Replies: 1
    Last Post: 2005-08-09, 05:11 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
  •