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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How Decode Choices in Dynamics CRM 365 Using Python or SQL

(1) ShareShare
ReportReport
Posted on by 7

Hello Community.

My first post here,

I have been using the following link to retrieve to decode option sets in a table

https://github.com/slavatrofimov/Synapse-Link-for-Dataverse-data-enrichment-in-Serverless-SQL-Pools/blob/main/SQL/Enrich%20Synapse%20Link%20for%20Dataverse%20Entities%20with%20Human-Readable%20Labels.sql

This works well if it is applied to Azure SQL Serverless Pool, however, can someone let me know if there is are any other methods that can used to achieve the same result but using Python?

I have the same question (0)
  • Suggested answer
    fabipfr Profile Picture
    13 on at
    I understand your trying to decode option set values and what label they are mapped to?

    e.g. statuscode 0=active, 1=inactive
     
    if this is what you're looking for there is a popular browser extension "level up for dynamics". if installed, navigate to a record of the entity you want to know the option set values of. click the extension > Forms > Show Option Set Values.
     
    Also there is the option to navigate to the table settings over make.powerapps.com. entity > columns > your option set column > edit. your able to see the labels and mapping there.
  • Suggested answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    Hi Santiago,

    Welcome to the community, and great question!

    You're right that decoding option sets (choices) in Dynamics 365 using SQL via Azure Synapse Serverless Pools is a common approach. If you're looking to do the same using Python, here are a couple of methods:

    1. Use the Web API Metadata Endpoint

    • Dynamics 365 exposes metadata via its Web API.
    • You can retrieve OptionSet metadata using Python and parse the labels.

    Example:

     
    import requests
     
    url = "https://your_org.crm.dynamics.com/api/data/v9.2/EntityDefinitions(LogicalName='account')/Attributes(LogicalName='your_field')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata"
     
    headers = {
        "Authorization": "Bearer <access_token>",
        "Accept": "application/json"
    }
     
    response = requests.get(url, headers=headers)
    data = response.json()
     
    # Extract option labels
    for option in data["OptionSet"]["Options"]:
        print(f"Value: {option['Value']}, Label: {option['Label']['UserLocalizedLabel']['Label']}")
     

     Use Dataverse Client Libraries

    • If you're working in Databricks or another Python environment, you can use the Dataverse Web API with libraries like requests or msal for authentication.

    Let me know if this helps, and please mark the response as helpful if it answered your question 😊

    Best regards!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Nagaraju_Matta Profile Picture

Nagaraju_Matta 123

#2
Hamza H Profile Picture

Hamza H 96 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans