web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Unable to access Multi...
Power Pages
Unanswered

Unable to access Multi Select Option Data

(0) ShareShare
ReportReport
Posted on by

Hi, 

I'm trying to access the values from a multi select choices column, but I can't seem to find the correct syntax and the value is always blank. I'm using FetchXML and then displaying the data as a JSON. 

 

Here is the code - 

const data = [
  {% fetchxml listings %}
<fetch>
  <entity name="crbd7_catalogue">
    <attribute name="crbd7_name" />
    <attribute name="crbd7_category" />
    <attribute name="crbd7_livestatus" />
    <attribute name="crbd7_tags" />
    <attribute name="crbd7_long" />
    <attribute name="crbd7_lat" />
    <filter>
      <condition attribute="crbd7_livestatus" operator="eq" value="1" />
    </filter>
  </entity>
</fetch>
  {% endfetchxml %}
  {% for crbd7_catalogue in listings.results.entities -%}
  {
    "name": "{{ crbd7_catalogue.crbd7_name }}",
    "tags": "{{ crbd7_catalogue.crbd7_tags }}",
    "live": "{{ crbd7_catalogue.crbd7_livestatus }}",
    "category": "{{ crbd7_catalogue.crbd7_category.Label }}",
    "long": {{ crbd7_catalogue.crbd7_long }},
    "lat": {{ crbd7_catalogue.crbd7_lat }}
  }
  {% unless forloop.last %},{% endunless %}
  {% endfor -%}
];
 
Any tips would be welcome.

Thanks

 

 

Categories:
I have the same question (0)
  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    I'm not sure which one is your multiselect option set but please note that, when you are retrieving this column, it will not give you a string instead the return type of column would be an array [] (list of selected values/labels). Please try to log it in console so you can see what you're getting.

     

    Let me know, if you need help.

     

    Thanks,

    Saud


    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

  • Community Power Platform Member Profile Picture
    on at

    Apologies, the multiselect option column is Tags.
    This is an example of the data I'm getting from the source of the page -
    {
    "name": "Cinema",
    "tags": "Adxstudio.Xrm.Web.Mvc.Liquid.OptionSetValueDrop",
    "live": "true",
    "category": "Activity",
    "long": -0.3,
    "lat": 52.47
    }

     

    I've tried adding Label or Value to the of  "tags": "{{ crbd7_catalogue.crbd7_tags, however, the field in the JSON is always blank. 

     

  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    Wondering, if you have tried label as well?

     

    {% assign fetchResult = fetchxmlquery.results %}
    
    {% for record in fetchResult.entities %}
     {% assign optionSetValue = record.fieldname %}
     {{ optionSetValue.label }}
    {% endfor %}

     

    Thanks,

    Saud


    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    on at

    Thanks Saud, yes  have tried "label" also. 

     

  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    Apologies for late reply, I tried it myself and concluded that Multiselect Option sets aren't exposed in Liquid objects. So perhaps you need to go for a workaround, perhaps plugin is an option. Here is another workaround to achieve this. 

     

    Here is the reference link for more clarification. 

     

    Thanks,

    Saud


    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

     

  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    If you don't have more questions. Please Mark the answer as Solution to enable other users to find it. 

     

    Thanks,

    Saud

  • Verified answer
    Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    The selections in a multi select option set / Choices column are available in Liquid fetchxml the following is from this link:

    https://learn.microsoft.com/en-us/power-pages/configure/choices-column#retrieve-selected-options-by-using-fetchxml

    {% fetchxml contacts %}
     <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
     <entity name="contact">
     <attribute name="firstname" >
     <attribute name="lastname" >
     <attribute name="sample_outdooractivities" >
     </entity>
     </fetch>
    {% endfetchxml %}
    {% for item in contacts.results.entities %}
    {
     "First Name":"{{ item.firstname }}",
     "Last Name":"{{ item.lastname }}",
     "Outdoor Activities": [
     {% for choice in item.sample_outdooractivities %}
     {{choice.Label}},
     {% endfor %}
     ]
    }
    {% endfor %}

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard