Skip to main content

Notifications

Power Apps - Microsoft Dataverse
Unanswered

Dynamically add Options in Attributes(datatype - choice)

(1) ShareShare
ReportReport
Posted on by 3
Dear Community,



I want to call MyWebsite API and fetch the list of some dropdown values, then put them in an Attibute of Choice Datatype in Dataverse Table. Can you please tell me how can I achieve that?



Detailed steps I want to achieve - 

1. Call My Website API (mywebsite.com/b2bapi/v2/functions/options)

2. Output of MyWebsite API - 
 
{
    "data": [
        {
            "name": "Chemicals",
            "id": 1412
        },
        {
            "name": "Engineering, Procurement and Construction",
            "id": 1553
        },
        {
            "name": "Finance/Banking",
            "id": 1414
        }]
}

3. Add 'name' and 'id' in 'Label' and 'Value' respectively in Dropdown Options(below screenshot)




Note: I don't want to add the options manually.
  • ivan_apps Profile Picture
    ivan_apps 2,185 on at
    Dynamically add Options in Attributes(datatype - choice)
    Is this a one-time operation you are trying to do? Or are you expecting to do this every time a page loads and needs to view this dropdown?
     
    If you are dynamically changing the values based on other fields in the form, i dont recommend using calling your API to populate your dropdown. Instead load all possible options into your dropdown and filter them using javascript. There is are .removeOption() and .addOption() functions in JS.
     
    If this is a one-time data load of options, you could use a C# console app to do this using the XRM Sdk. You should be able to create a field or global optionset and set the options. But my follow up would be that if you have more than 10 options, and have dynamically changing criteria - is there a reason you arent loading this data into another table and using a Lookup to reference it? There are PCF controls that can make the lookup look like a dropdown if thats the issue.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard

Featured topics