diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 28491807..33a42ee8 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -89,11 +89,11 @@ namespace AyaNova.DataList { List row = new List(returnRowColumnCount); - + //INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST foreach (string TemplateField in ListViewFieldList) { - + //get the AyaObjectFieldDefinition AyaDataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(x => x.FieldKey == TemplateField); if (f.IsCustomField) @@ -106,7 +106,14 @@ namespace AyaNova.DataList JObject j = JObject.Parse(cust); //convert field name to cust name then get value var InternalCustomFieldName = AyaFormFieldDefinitions.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField); - AyaField.v = j[InternalCustomFieldName].Value(); + //Sometimes a custom field is specified but doesn't exist in the collection so don't assume it's there + // AyaField.v = j[InternalCustomFieldName].Value(); + JToken o = j[InternalCustomFieldName]; + if (o != null) + AyaField.v = o.Value(); + else + AyaField.v = null; + row.Add(AyaField); }