function getFields(changedElement) {
var required = [];
fields = [];
- options = getFieldData = {};
+ options = {};
+ getFieldData = {};
// Special case for getfields
if (action === 'getfields') {
fields.push({
return;
}
CRM.api3(entity, 'getFields', {'api_action': action, options: {get_options: 'all'}}).done(function(data) {
- getFieldData = data.values;
_.each(data.values, function(field) {
if (field.name) {
+ getFieldData[field.name] = field;
fields.push({
id: field.name,
text: field.title || field.name,