From 5b0ce90157680e9c892458f9b60cf2d7387d7fd4 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 27 Feb 2020 19:14:46 +0000 Subject: [PATCH] --- server/AyaNova/DataList/DataListFetcher.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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); }