4

I have a Schema in Tridion that has a field where the values are set from a Category as a check box list. I can see that you can use the Tag Model for a a single Keyword field but how do you map a check box list that returns multiple values

When I set the field type to Tag I get the first Keyword selected in the list.

[SemanticProperty("s:services")]
public Tag Services { get; set; }

When I set the field to List<Tag> I get nothing.

[SemanticProperty("s:services")]
public List<Tag> Services { get; set; }
1
  • 2
    I have not had much time to look into this, but since the keyword field is a multivalue vield, are you using the correct mapping (adding an s to the fieldname), or have you considdered adding a semantic mapping for that specific field? Commented Feb 23, 2016 at 9:26

1 Answer 1

3

Bart's comment was correct. I had named my schema field incorrectly. Quoting the manual:

When attempting to populate a property of type List, remove any trailing s's from the property name. For example, the Paragraphs property is mapped to Schema field paragraph.

So I modified my schema to rename the field to service, changed the model to remove the trailing s, republished the settings page, republished the page that had the Component on it and it all works.

[SemanticProperty("s:service")]
public List<Tag> Services { get; set; }

This naming convention for lists has tripped me up many times but my brain decided not to figure this one out late yesterday but kicked in this morning!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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