Saturday, January 9, 2016

[sugarcrm] Add fields non-db into search advance

Example for this case that i want add from date and to date for advance search.
i want to find student with condition student of birhtday.
I do the some step below
Step 1: Go to custome Vardefs modue (ex: custom\Extension\modules\isa_students\Ext\Vardefs\ )folder and create new file with name tanphuqn_field_nondb_fromdatetodate.php
Then you copy and paste my scirpt
// taphuqn add 01/11/2015
 $dictionary["isa_students"]["fields"]["fromdatetodate_non_db"]= array(
   'name' => 'fromdatetodate_non_db',
    'rname' => 'fromdatetodate_non_db',
   'vname' => 'LBL_FROMDATE_TODATE_NON_DB',
   'source' => 'non-db',
   'dbType' => 'non-db',
   'type' => 'date',
   'options' => 'date_range_search_dom',
   'enable_range_search' => true,
   'studio' => 'visible',
   'is_date_field' => true,
);

this field is non db when source and dbType is non-db.

Step 2: Add language for this non-db field. You go to custom module(ex:custom\modules\isa_students\language\)
Ex:
'LBL_FROMDATE_TODATE_NON_DB' => 'From date and to date',

Step 3: Repair sugarcrm
You go to Admin-> Repair

Then you click Quick Repair and Rebuild
Step 4: Add field which you have just added to advance search
Go to Admin->Studio and select module which you added non-db field. Ex this module is student
Then you go to advance seach layout


Click advance search icon 

Then you select this non-db field(ex: from date and to date) to Default from Hidden

Step 5: Quick Repair and Rebuild again
Step 6: Check advance search on module which you want to display non-db field (ex: student module)




No comments: