Results 1 to 5 of 5

Thread: searchdefs referencing a field from another module in 5.0.0b, bug??

  1. #1
    frankext is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    43

    Default searchdefs referencing a field from another module in 5.0.0b, bug??

    Dear all,
    I tried note 2 of below -> referencing a field that comes from an another module, on 5.0.0b,
    but seems no work. Is it a bug? Anyone could help please...

    -------------------------------------------------
    $searchFields
    From SugarCRM Wiki
    This article is for SugarCRM 4.5.0 or later.

    This page refers to $searchFields which is metadata for Search Forms in SugarCRM. This is located in modules/moduleDir/metadata/SearchFields.php You can override the values by creating the file custom/modules/moduleDir/metadata/SearchFields.php

    Example from Accounts module:

    $searchFields['Accounts'] =
    array (
    'name' => array('query_type'=>'default'),
    'account_type'=>
    array('query_type'=>'default',
    'options' => 'account_type_dom',
    'template_var' => 'ACCOUNT_TYPE_OPTIONS'),
    'address_postalcode'=>
    array('query_type'=>'default',
    'db_field'=>array('billing_address_postalcode',
    'shipping_address_postalcode'))
    );

    Note 2: If you are referencing a field that comes from an another module (e.g. account_name in Contacts search: 'db_field => accounts.name'), make sure to specify 'join_name => 'accounts' in vardefs.php (eg. of Contacts module) under the 'account_name' field (which would be of type 'relate'). This tells Sugar what prefix to use when joining on that field, otherwise it will return an 'unkown column name' error during SQL execution.

    Retrieved from "http://www.sugarcrm.com/wiki/index.php?title=%24searchFields"

    frankext

  2. #2
    frankext is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    43

    Default Re: searchdefs referencing a field from another module in 5.0.0b, bug??

    Quote Originally Posted by frankext
    Dear all,
    I tried note 2 of below -> referencing a field that comes from an another module, on 5.0.0b,
    but seems no work. Is it a bug? Anyone could help please...

    -------------------------------------------------
    $searchFields
    From SugarCRM Wiki
    This article is for SugarCRM 4.5.0 or later.

    This page refers to $searchFields which is metadata for Search Forms in SugarCRM. This is located in modules/moduleDir/metadata/SearchFields.php You can override the values by creating the file custom/modules/moduleDir/metadata/SearchFields.php

    Example from Accounts module:

    $searchFields['Accounts'] =
    array (
    'name' => array('query_type'=>'default'),
    'account_type'=>
    array('query_type'=>'default',
    'options' => 'account_type_dom',
    'template_var' => 'ACCOUNT_TYPE_OPTIONS'),
    'address_postalcode'=>
    array('query_type'=>'default',
    'db_field'=>array('billing_address_postalcode',
    'shipping_address_postalcode'))
    );

    Note 2: If you are referencing a field that comes from an another module (e.g. account_name in Contacts search: 'db_field => accounts.name'), make sure to specify 'join_name => 'accounts' in vardefs.php (eg. of Contacts module) under the 'account_name' field (which would be of type 'relate'). This tells Sugar what prefix to use when joining on that field, otherwise it will return an 'unkown column name' error during SQL execution.

    Retrieved from "http://www.sugarcrm.com/wiki/index.php?title=%24searchFields"

    frankext
    Anyone? Help...Help...
    The second call~~~

    frankext

  3. #3
    mouette is offline Junior Member
    Join Date
    Mar 2008
    Posts
    3

    Default Re: searchdefs referencing a field from another module in 5.0.0b, bug??

    We have the same problem too. We have investigated a lot.
    Our use case :
    We need a custom field for Accounts ("sector") and we want to be able to filter Contacts by sector.
    To do this :
    - we add a custom field "sector" to Accounts module. This field is stored in the custom table "accounts_cstm".
    - we declare the field "account_sector" in the Contacts vardef (custom)
    - we declare "account_sector" in Contacts SearchFields
    - we append "account_sector" to searchdefs

    And it doesn't run because there is an error in the SQL Query because Sugar doesn't include the LEFT JOIN account_cstm in the request.

    Is it a bug?

    We don't find any workaround, except to declare our custom field in the main Accounts table and it's not staisfactory at all!

  4. #4
    frankext is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    43

    Default Re: searchdefs referencing a field from another module in 5.0.0b, bug??

    Quote Originally Posted by frankext
    Anyone? Help...Help...
    The second call~~~

    frankext
    Third call...
    Any Sugarman?! Help~~~~!

  5. #5
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: searchdefs referencing a field from another module in 5.0.0b, bug??

    I'm not sure if you guys are still looking for the answer to this but there is now a module available called Related Data at the www.eggsurplus.com store that allows you to search on related information like you're looking for. Below is a screen shot of an example which allows you to search for Contacts based on the related Account state:



    Let me know if you have any questions,

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 2008-02-11, 02:50 PM
  2. Replies: 2
    Last Post: 2007-08-02, 04:54 PM
  3. Replies: 2
    Last Post: 2007-05-23, 03:01 PM
  4. Replies: 0
    Last Post: 2007-04-25, 06:16 AM

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
  •