What is missing in my custom field vardef?

Hello. I need to add an integer field to currencies. I created the file custom/Extension/modules/Currencies/Ext/Vardefs/c_primary_key_c.php

It contains the following:

<?php
$dictionary['Currency']['fields']['c_primary_key_c']['name'] = 'c_primary_key_c';
$dictionary['Currency']['fields']['c_primary_key_c']['id'] = 'c_primary_key_c';
$dictionary['Currency']['fields']['c_primary_key_c']['type'] = 'Integer';
$dictionary['Currency']['fields']['c_primary_key_c']['dbType'] = 'integer';
$dictionary['Currency']['fields']['c_primary_key_c']['source'] = 'custom_fields';
$dictionary['Currency']['fields']['c_primary_key_c']['len'] = 10;
$dictionary['Currency']['fields']['c_primary_key_c']['size'] = 10;
$dictionary['Currency']['fields']['c_primary_key_c']['unified_search'] = false;

What am I missing, as this is not detected when I do Quick Repair?
Parents Reply Children
  • Yes, no luck. This is how I tried:

    $dictionary['Currency']['fields']['c_primary_key_c']['name'] = 'c_primary_key_c';
    $dictionary['Currency']['fields']['c_primary_key_c']['vname'] = 'Dimensions key';
    $dictionary['Currency']['fields']['c_primary_key_c']['id'] = 'c_primary_key_c';
    $dictionary['Currency']['fields']['c_primary_key_c']['type'] = 'int';
    $dictionary['Currency']['fields']['c_primary_key_c']['dbType'] = 'int';
    $dictionary['Currency']['fields']['c_primary_key_c']['source'] = 'custom_fields';
    $dictionary['Currency']['fields']['c_primary_key_c']['len'] = 10;
    $dictionary['Currency']['fields']['c_primary_key_c']['size'] = 10;
    $dictionary['Currency']['fields']['c_primary_key_c']['unified_search'] = false;

  • I tried on my instance and with your full definition it is not working.

    If you just put the 3 lines and accept the field to be created in the core table, it works.

    2 possibilities

    - the currency module canno't manage a _cstm extension table

    - the table must exists in order to perform the repair (I got error message in the sugarcrm.log with your definition)

  • It is paramount to put into the _cstm table. SugarCRM itself announced us in a in-house webinar (they visited our company) that sometimes they upgrade core table structure by copy, drop table, create, copy from clone back, instead of alter table. And in general is bad practice to put custom fields into core table. One of the reasons why I am rewriting our entire codebase is to rip out the custom fields from the core table. Should I go to sugar portal and contact them?