AnsweredAssumed Answered

Mismatch between model.attributes and model.fields

Question asked by Soon Van on Mar 16, 2017
Latest reply on Mar 16, 2017 by Soon Van

Am having an issue in Sugar 7.7.x trying to understand why there is a discrepancy or mismatch between what fields are included or available in the this.model.attributes and this.model.fields list.

 

Triggered by running search, the following line has been added in the quicksearch.hbs Handlebars template:

 

{{log model}}

 

In the browser console this is then bringing back the model per matching record. However, am seeing some custom and normal fields missing between the two. Namely they are missing from the model.attributes list, even though they appear in the model.fields list.

 

For example, in model.attributes these appear

  • name
  • street_address

 

While in model.fields these are mentioned

  • name
  • street_address
  • gender
  • work_street_address_c

 

Have done a Repair & Rebuild. Have made sure the vardefs match the fields_meta_data database table. These are non-empty values. Am testing as an admin. Nothing under custom directory is otherwise making changes to those fields. Fields have been added to the layouts in record, list and search views.

 

Cannot understand why model.fields will list all the fields on the model, but in model.attributes it will exclude some. Any ideas?

Outcomes