Membership Membership:
Latest New User Latest: vpros
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 137

People Online People Online:
Visitors Visitors: 13
Members Members: 0
Total Total: 13

NakedMCSE Computer Tech Support Forums

So you have passed all of the exams and you are now out in the real world of windows servers, linux servers and freebsd servers faced with a tech support problem you have never seen before...

Find free online tech support in the forums below, respecting that advice is free, but work beyond advice is not...

The General forum is provided for off topic discussion.

You need a user account to post - please Register or Login.

Online Tech Support Forums
 
  Forum  Discussions  General  Implementing cross module search fields in SugarCRM
Previous Previous
 
Next Next
New Post 6/21/2011 5:16 PM
Informative
  Walker
119 posts
www.lairdscomputer.com
10th Level Poster


Implementing cross module search fields in SugarCRM 
Modified By Walker  on 6/21/2011 5:16:53 PM)

Sometimes it is necesarry to be able to search a related field in another modules data from the search field for a module.

To implement this you need to know the underlying database structure and edit two files in the module.

First you have to edit the metadata/searchdefs.php file to add an entry for the field that you wish to search.  You can add it to the basic search or advanced search section.  In my example here I wanted to add the ability to search line items in a quote:

array('name'=>'line_items', 'label'=>'Line Items', 'type'=>'name', 'default'=>true),

Then you need to edit the metadata/SearchFields.php file to add the query:

'line_items'=> array('query_type'=>'default', 'operator'=>'innerjoin','innerjoin'=>'INNER JOIN aos_products_quotes ON (aos_products_quotes.parent_id=aos_quotes.id AND aos_products_quotes.description LIKE', 'db_field'=>array('id',),),

There are two choices of operator here - innerjoin and subquery.  In almost all cases use innerjoin as mysql does not handle subqueries well.

Finally go into studio and open up either the basic or advanced search layout (which every you added the field to in searchdef.php), and then save and deploy.  Your cross module search should now be active.

Walker
www.lairdscomputer.com

 
Previous Previous
 
Next Next
  Forum  Discussions  General  Implementing cross module search fields in SugarCRM
Send me One Million FREE Guaranteed Visitors