non existing field in module: Accounts

Hi All,

I just joined a team using Sugarcrm (SugarPro version 10) and we customize it a lot.

I am new to Sugarcrm and recently I got a Error message: Non existing field: xxxx in module: Accounts. in my local development.

This field should be existed before and we are still using that field in production.

I tried to create the missing field in the database table then run Quick Repair and Rebuild but not luck.

I have no idea what should I do next. I would appreciate any ideas.

Cheers,

Manson

  • It may help to know what you were doing when you had this error. Did you get it when opening Accounts list view?

    To check if the field exists I would start by looking to see if xxxx is in your Accounts module in Studio

    If it is, you should also find it in cache/modules/Accounts/Accountvardefs.php, which is a temporary file that compiles custom and stock metadata and is rebuilt when you do a Quick Repair and Rebuild (QRR)

    Your custom field's specific metadata should be in a file in custom/Extension/modules/Accounts/Ext/Vardefs/.

    and most likely called sugarfield_xxxx.php where xxxx is the name of the field.

    In the database, you should have the field in the accounts_cstm table (I'm assuming we're talking about a custom field)

    and in the fields_meta_data table.

    You should never have to manually create anything in the database, after all you wouldn't even have access to the database on the cloud, if your vardefs are correct the QRR should take care of syncing things between the application and the database, and should prompt you for any SQL that needs to be executed to match the two when something is added (this is transparent to you when you add a field via studio).

    I did a quick search and the error you are getting is in include/api/SugarApi.php (Sugar uses APIs in its application, as well as being available as EndPoints from external applications for your integrations etc.)

    In this particular case it looks like the error is triggered by a missing field being used in a getOrderByFromArgs

    So depending on where you were and what view you were on when the error happened.

    If you were in Accounts list view, take a look at your custom/modules/Accounts/clients/base/views/list/list.php and see if you have an 'orderBy' specified and if the 'field' is your xxxx, which would explain the error.

    I am assuming xxxx is not a stock field but one you added, a custom field, perhaps it's an old field that was being used as the orderBy and is no longer in use?  (You should never remove fields that are out of the box, just hide them from the view if you don't want to use them)

    I hope this helps you dig a little deeper to find the source of your issue.

    Good luck! And welcome to the Club! :)

    FrancescaS

  • When you set up your local development environment; did you bring over the fields_meta_data table from the database? That table has all of the definitions of the custom fields.

  • I can’t find the field in this file - cache/modules/Accounts/Accountvardefs.php

    In the database accounts_cstm table - I can’t find the field (and I try to create myself, Seem I shouldn't)

    fields_meta_data table - I can’t find the the record

    But I can find it in this file custom/Extension/modules/Accounts/Ext/Vardefs/.

    custom/modules/Accounts/clients/base/views/list/list.php

    I can find the field,

    8 =>
    
    array (
    
    'name' => 'XXX_c',
    
    'label' => 'LBL_XXX_C',
    
    'enabled' => true,
    
    'default' => true,
    
    ),

    You should never have to manually create anything in the database – NOTED

    after all you wouldn't even have access to the database on the cloud – We are still using local database

    The problem solved

    copy all data from fields_meta_data table to my local database, then run Quick Repair and Rebuild

    Thank you guys for the answer so much details, I learn a lot.