Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Unanswered

Get Avaialble options from an Option Set in Power Pages Portal

(0) ShareShare
ReportReport
Posted on by 120

I am building a page that will display a list of records from a Dataverse table. The tabe includes a 'Status' Choice column.

I would like to display the availilable status with radio buttons, so portal user can click a status to just see the records that match the selected status.

 

The records will be retrieved using fetchXML/liquid, instead of an Entity List, so I can construct the fetchXML based on the selected status, and output the result into a <table> so that I can format it anyway I like.

 

However, I don't seem to be able to find a way to extract the available options from the 'Status' column. I'm trying to get the available options from the column or from the referenced Choice, so that even if the the available options are updated in future I won't need to update code.

 

Some people suggested using fetchXML to query the 'stringmap' table which requires adding table permission for portal users to access. But as it's a system table and Microsoft specifically hides it from the 'Tables' page in make.powerapps.com, I am a bit reluctant to fool around with it.

 

I have investigated the Portal Web API which doesn't have a method to get Option Sets.

The Dataverse Web API does provide a method to do so, but I can't find a way to call it from the Portal.

 

Anyone know the proper way to achieve my requirement? If not, then I will have to hard code the option values and labels into a Content Snippet.

 

Categories:
  • jlarach07 Profile Picture
    4 on at
    Re: Get Avaialble options from an Option Set in Power Pages Portal

    Thank you @HarrisonSouza! I was able to fetch them from the stringmap table.

  • HarrisonSouza Profile Picture
    7 on at
    Re: Get Avaialble options from an Option Set in Power Pages Portal

    Hi @jlarach07, sure:

     

    To enable the stringmap table for the WebAPI, you must follow the same process you would do for any other table (e.g. account).

    The following is a code sample to retrieve rows from the stringmap table, filtering for the statecode column from the account table:

     async function RetrieveAccountStateCodes() {
     return new Promise((resolve, reject) => {
     webapi.safeAjax({
     type: "GET",
     url: "/_api/stringmaps?$select=attributename,attributevalue,objecttypecode,value&$filter=(objecttypecode eq 'account' and attributename eq 'statecode')",
     contentType: "application/json",
     headers: {
     "Prefer": "odata.include-annotations=*"
     },
     success: function (data, textStatus, xhr) {
     resolve(data)
     console.log(data);
     },
     error: function (xhr, textStatus, errorThrown) {
     console.log(xhr);
     reject(errorThrown);
     }
     });
     });
     }

     

  • jlarach07 Profile Picture
    4 on at
    Re: Get Avaialble options from an Option Set in Power Pages Portal

    Hi Harrison. I am trying to do the same. Can you please post an example of how you called the stringmap table?

  • HarrisonSouza Profile Picture
    7 on at
    Re: Get Avaialble options from an Option Set in Power Pages Portal

    Thank you, Oliver. I've used the stringmap table with the WebApi and it worked as expected!

  • oliver.rodrigues Profile Picture
    9,315 Most Valuable Professional on at
    Re: Get Avaialble options from an Option Set in Power Pages Portal

    Hi, a few points here:

    • do you need to use custom Fetch? you might able to use OOB Lists + Filters
    • do you need to retrieve the Status? if you are building a custom page using HTML/Liquid, I don't see any issues on hard-coding the status code references in your page, this is not something that will be changing

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics