I have a checklist with value(a,b,c,d) in the items.
In the rendering variant template how can I check If 'a' is checked? I am using Sitecore 9.2
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityI have a checklist with value(a,b,c,d) in the items.
In the rendering variant template how can I check If 'a' is checked? I am using Sitecore 9.2
Note that NVelocity is removed in version 9.3 so if you have other options you might want to use those.
But to answer your question, you could do something like this:
#set ($checks = $item.Fields.get_Item("YourCheckListField").ToString)
#if ($checks.contains("THE-GUID-OF-THE-ITEM-A"))
... do your stuff
#end
This gets the value from the field, which will be the raw value so the '|' delimited string of guids (in capitals). You can check if the guid of your "A" item is in there.