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
  • Hi,

    I recommend to only create a basic definition and then update it after the repair

    $dictionary['Currency']['fields']['c_primary_key_c']['name']='c_primary_key_c';
    $dictionary['Currency']['fields']['c_primary_key_c']['vname']='LBL_C_PRIMARY_KEY_C';
    $dictionary['Currency']['fields']['c_primary_key_c']['type']='int';

    it's also better to name your file sugarfield_<thenameofyourfield>.php so it won't create another field after the repair (that can cause mistake with contradictory parameters) ; in my opinion, you can also avoid the _c because your field won't be considered as a custom field (not created from the studio) so it won't be store in the _cstm table but in the core one.

    Fred

Reply
  • Hi,

    I recommend to only create a basic definition and then update it after the repair

    $dictionary['Currency']['fields']['c_primary_key_c']['name']='c_primary_key_c';
    $dictionary['Currency']['fields']['c_primary_key_c']['vname']='LBL_C_PRIMARY_KEY_C';
    $dictionary['Currency']['fields']['c_primary_key_c']['type']='int';

    it's also better to name your file sugarfield_<thenameofyourfield>.php so it won't create another field after the repair (that can cause mistake with contradictory parameters) ; in my opinion, you can also avoid the _c because your field won't be considered as a custom field (not created from the studio) so it won't be store in the _cstm table but in the core one.

    Fred

Children