我不認爲你可以實現你在ListView中尋找的結果,就像你可以在EditView & DetailView中一樣。一種解決這個問題的方法是將一個非db字段添加到Leads vardefs中,並使用邏輯掛鉤來處理條件格式。
創建一個新的vardef:
/custom/Extension/modules/Cases/Ext/Vardefs/my_listview_value_c.php
<?php
$dictionary['Lead']['fields']['my_listview_value_c'] = array(
'name' => 'my_listview_value_c',
'vname' => 'LBL_MY_LISTVIEW_VALUE_C',
'type' => 'varchar',
'len' => '255',
'source' => 'non-db',
);
?>
創建邏輯鉤:
/custom/modules/Leads/ListViewLogicHook.php
<?php
class ListViewLogicHook {
public function getListValue(&$bean, $event, $arguments) {
if ($bean->ld_assumed_sugar_account_id_c) {
$bean->my_listview_value_c = $bean->account_name;
} else {
// Whatever you'd like
}
}
}
添加邏輯鉤條目:
// position, file, function
$hook_array['process_record'] = Array();
$hook_array['process_record'][] = Array(1, 'Conditional formatting in a listview column', 'custom/modules/Leads/ListViewLogicHook.php','ListViewLogicHook','getListValue');
最後,在listviewdefs添加新列:
'MY_LISTVIEW_VALUE_C' =>
array (
'width' => '10%',
'label' => 'LBL_MY_LISTVIEW_VALUE_C',
'default' => true,
),
希望有所幫助。