Function Fields.

There are two different function fields depending on what module you are wanting to use it with. From what I can see the firstĀ one is for the newer modules e.g contacts,account etc


$dictionary["Contact"]["fields"]['account_country_c'] =
    array (
        'name' => 'account_country_c',
        'vname' => 'LBL_ACCOUNT_COUNTRY_C',
        'type' => 'function',
        'source' => 'non-db',
        'studio' => 'visible',
        'function' =>
            array (
                'name' => 'account_country_function',
                'returns' => 'html',
                'include' => 'custom/modules/Contacts/customfields.php'

the file it relates to contains 

function account_country_function($focus, $field, $value, $view){

    $bean = BeanFactory::getBean("Accounts", $focus->account_id);

    return $bean->shipping_address_country;


The following is for what looks like the older modules for example Campaigns.

$dictionary['CampaignLog']['fields']['account_country2_c'] =    array (

        'name' => 'account_country2_c',






        'function_params'=> array('account_id'),

        'function_params_source'=>'this',  //valid values are 'parent' or 'this' default is parent.

class custom_contact_fields{

function account_country_function($account_id){

$bean = BeanFactory::getBean("Accounts", $account_id);

return $bean->shipping_address_country;