_.each(results, function(fields, entityName) {
var entity = getEntity(entityName);
_.each(fields, function(options, fieldName) {
- _.find(entity.fields, {name: fieldName}).options = options;
+ var field = _.find(entity.fields, {name: fieldName});
+ if (field) {
+ field.options = options;
+ }
});
entity.optionsLoaded = true;
});
if (!_.includes(['>', '<', '>=', '<='], ctrl.op)) {
// Only use option list if the field has a "name" suffix
- if (field.options && field.suffixes && field.suffixes.includes('name')) {
+ if (field.options && (!field.suffixes || field.suffixes.includes('name'))) {
return '~/crmSearchTasks/crmSearchInput/select.html';
}
if (field.fk_entity || field.name === 'id') {