-1

I am currently working on upgrading Sitecore 8.2 to 9.3, I came across the multi-list field with Search where we were able to get the items in 8.2 but not in 9.3. Please find the below code used to get the items from Multilist field with Search:

 MultilistField refMultilistField = sectionItem.Fields[ISection_DefinitionConstants.Selected_SectionsFieldName];
     if (refMultilistField != null)
     {
         Item[] items = refMultilistField.GetItems();
                        foreach (Item templateSectionItem in items)
                        {
                            TemplateSection templateSection = new TemplateSection();
                            templateSection.TemplateSectionId = templateSectionItem.ID.Guid;
                            templateSection.TemplateSectionName = templateSectionItem.Name;
                            sectionDefination.SelectedSectionItems.Add(templateSection);
                        }
     }

In 9.3, the item value is Sitecore.Data.Items.Item[0] but we are able to get the items in 8.2.

Could anyone please suggest if there any modifications in Sitecore 9.3 related to the Multilist with Search datatype?

0

When you assign refMultilistField you might try wrapping it in an explicit cast ((MultilistField){your code})

1
  • 1
    That explicit cast will happen anyway since refMultilistField is explicitly typed as MultilistField
    – Mark Cassidy
    Jun 15 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.