diff --git a/src/EpiserverAdapter/Helpers/PimFieldAdapter.cs b/src/EpiserverAdapter/Helpers/PimFieldAdapter.cs index 8b4ba0d..a7bac4c 100644 --- a/src/EpiserverAdapter/Helpers/PimFieldAdapter.cs +++ b/src/EpiserverAdapter/Helpers/PimFieldAdapter.cs @@ -84,8 +84,15 @@ public string GetAllowSearch(FieldType fieldType) public List GetCVLValues(Field field) { var dataElements = new List(); - if (field == null || field.IsEmpty()) + if (field == null) + return dataElements; + + if (field.IsEmpty()) + { + XElement dataElement = GetEmptyCvlDataElement(_config.ChannelDefaultLanguage); + dataElements.Add(dataElement); return dataElements; + } CVL cvl = CVLs.FirstOrDefault(c => c.Id.Equals(field.FieldType.CVLId)); if (cvl == null) @@ -296,6 +303,15 @@ private XElement GetCvlDataElement(Field field, CultureInfo language) return dataElement; } + private XElement GetEmptyCvlDataElement(CultureInfo language) + { + var dataElement = new XElement("Data", + new XAttribute("language", language.Name.ToLower()), + new XAttribute("value", "")); + + return dataElement; + } + private string GetCvlFieldValue(Field field, CultureInfo language) { if (FieldIsExcludedCatalogEntryMarkets(field))