Results 1 to 2 of 2

Thread: onetomany relationship problome

  1. #1
    pouya.bahavar is offline Junior Member
    Join Date
    Jul 2009
    Posts
    1

    Default onetomany relationship problome

    hi
    i have created a custom module named aaa_cdr which has a one to may relationship with the account module .for this relationship both modules use custom key's aaa_cdr uses userid and account uses jbilling_id for the relationship.
    when ever i try to show the subpanel for account the primary key of account is used instead of the my custom field. so far i'v haven't come across any similar cases .

    hers my account vardef :

    $dictionary['Account']['fields']['cdr'] = array (
    'name' => 'cdr',
    'type' => 'link',
    'id_name' => 'jbilling_id',
    'relationship' => 'aaa_account_cdr',
    'module' => 'aaa_Cdr',
    'bean_name' => 'aaa_Cdr',
    'source' => 'non-db',
    'vname' => 'LBL_AAA_CDR',
    'join_name' =>'aaa_account_cdr',
    );

    $dictionary['Account']['relationships']['aaa_account_cdr'] = array (
    'lhs_module' => 'Accounts',
    'lhs_table' => 'accounts',
    'lhs_key' => 'jbilling_id',
    'rhs_module' => 'aaa_Cdr',
    'rhs_table' => 'aaa_cdr',
    'rhs_key' => 'userid',
    'relationship_type' => 'one-to-many',
    'join_table' => 'aaa_cdr',
    'join_key_lhs' => 'jbilling_id',
    'join_key_rhs' => 'userid',

    );

    and heres the query that it generates :
    SELECT aaa_cdr.id , aaa_cdr.id , aaa_cdr.trans_dttm , aaa_cdr.callednum , aaa_cdr.destination , aaa_cdr.duration , aaa_cdr.ratedamount , 'aaa_cdr' panel_name FROM aaa_cdr where ( aaa_cdr.userid= '5351b95a-68af-a4c1-dbec-4a4454ef7797' AND aaa_cdr.deleted=0) AND aaa_cdr.deleted=0 ORDER BY aaa_cdr.id desc

    the underscored value is the value for account id instead of jbilling_id.
    how can i tell sugar to use the custom field (jbilling_id) instead off the primary key(id)?
    thanks in advance.

  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: onetomany relationship problome

    Hi pouya

    How did you create the relationship?

    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.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Self Join (or 'recursive relationship') relationship in Accounts
    By ChristineCapra in forum Developer Help
    Replies: 6
    Last Post: 2009-07-04, 10:51 AM
  2. Deleted relationship breaks relationship editor
    By door3ahmed in forum Developer Help
    Replies: 3
    Last Post: 2009-02-12, 06:09 AM
  3. Replies: 10
    Last Post: 2009-02-04, 05:16 PM
  4. SOAP Set Relationship - how to delete a relationship?
    By darcy.rippon in forum Developer Help
    Replies: 0
    Last Post: 2009-02-02, 07:22 PM
  5. Replies: 1
    Last Post: 2006-11-20, 07:06 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
  •