Hello all,
I am trying to change the order in which the fields are shown when merging two contacts. I found no solution on my own.
Can somebody help me?
Thanks in advance! ![]()
Hello all,
I am trying to change the order in which the fields are shown when merging two contacts. I found no solution on my own.
Can somebody help me?
Thanks in advance! ![]()
Are you trying to order particular field on list view? Need more context!
@rsp go to list view, select two or more records, open “Bulk Actions”, press “Merge”
@fuhlit are you a developer? The code is in
modules/MergeRecords
I don’t have time to check how the screen is built, but it’s looping over field names, possibly it’s just using the order of the fields from the vardefs; I am not sure if that’s a good place to try changing the order, but it’s worth a try.
Other than that, you can always hack to code directly to change the array order before building the screen. This is really old code, uses the extremely ancient xtpl library instead of the very old Smarty.
![]()
Sorry, that was toooo good to go uncommented ![]()
Hi @fuhlit
Short answer: Yes, it is possible.
The rest depends on the scope and complexity of the customization.
How it works: Inside modules/MergeRecords/Step3.php (around line 157), the list of fields is fetched using the following code:
$temp_field_array = $focus->merge_bean->field_defs;
Since this is a standard PHP array, you can apply custom PHP array operations to sort or manipulate it as per your requirements.
You can also review modules/MergeRecords/Step3.html and modules/MergeRecords/MergeField.html for the display-related structure to evaluate whether an alternative UI-level approach would work for your use case.
High-level Structure / Flow
The relevant code resides under modules/MergeRecords, primarily in modules/MergeRecords/Step3.php. At a high level (for developers who prefer reverse engineering):
Step3.php pulls $temp_field_array directly from the merge bean’s field_defs.
The source of these field_defs is the bean loaded by MergeRecord::load_merge_bean() for the selected module.
The bean’s field_defs are populated in the SugarBean constructor from the vardefs dictionary (loaded via VardefManager::loadVardef), along with any custom fields added through setupCustomFields().
Code flow reference:
Step3.php (lines ~107–160):
$focus = BeanFactory::newBean(‘MergeRecords’);
$focus->load_merge_bean($_REQUEST[‘merge_module’], true, $base_id);
…
$temp_field_array = $focus->merge_bean->field_defs;
load_merge_bean() instantiates the module’s bean class:
MergeRecord.php (lines ~110–135)