1

I am trying to access the multilist field from datasource in scriban template and getting the following error. The code snippet is given below,

enter image description here

<div class="row-section">
{{
    for contentItem in (sc_follow i_item "Item List")
}}
{{ contentType=(sc_follow  contentItem 'Content Section') }}
<div class="slider ">
<div class="content bar">
    <div class="image-wrapper">
    
<div class="card-types">
       <p class="card-type" card-type="{{contentType.Name}}">{{contentType.Name}}</p>
      
</div>

</div>

  </div>
 </div>

 {{
   end
 }}

</div>
</div></div>
{{
 end
 }} 

2 Answers 2

1

Use the following code to access the multilist field from datasource...

{{ for contentItem in (sc_followmany i_item "Item List") }}
1
  • Thanks for the quick help....it helped me to resolve the issue
    – manisha289
    Commented May 31, 2022 at 6:49
1

Please use below scriban code to get data from multilist field

{{ for i_product in (sc_followmany i_page "Related Products") }}
  <h2>{{ sc_field i_product "Title" }}</h2>
  <b>Content</b>:{{ sc_field i_product "Content" }}
{{ end }

For more information ,please use below link and to avoid such errors try add if else conditions and add null check.

https://doc.sitecore.com/xp/en/developers/sxa/93/sitecore-experience-accelerator/the-embedded-functions-for-the-scriban-template.html

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.