cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nickellis74
Resolver I
Resolver I

Getting the Choice value from the display name

Hi all

 

I'm hoping this one is simple enough, but I've struggled with it. How do I go backwards from the Display Name of a Dataverse Choices column to the value?

 

Scenario:

I need to integrate an external system with Dataverse using Power Automate. The two systems share a dropdown which has the same display name list, but obviously different underlying values. The flow is (roughly):

  1. Call the third-party API and get a record in JSON format
  2. Within that, find the 'Type' field which is presented as below
  3. Use the 'name' element to identify the corresponding value in the Dataverse choices and set a field accordingly

 

{
            "id": 34,
            "name": "Procurement",
            "_info": {
                "type_href": "https://someurl.com/"
            }
        }

 

I don't care about the URL field. In this specific scenario, I need to map from 34 on the 3rd party side to 693,480,003 on the Dataverse side. I'll be honest, since they are sequential on both sides I have considered simply adding 693,479,969 but that doesn't seem like best practice! 😀

 

Here it is on the third party side:

nickellis74_0-1621272682509.png

 

And here it is on the Dataverse side

nickellis74_1-1621272732133.png

 

Any help greatly appreciated! Thanks

Nick

 

1 ACCEPTED SOLUTION

Accepted Solutions
nickellis74
Resolver I
Resolver I

Thanks @amitprajapati for the help. My concern with this approach is that it hard codes the values, and sadly they tend to change - or at least be added to - fairly regularly.

 

After a bit of blog hunting, I came up with the following approach. It is heavily based on this blog: Updating Dataverse Optionset/Choice from Text dynamically using Power Automate (d365geek.co.uk)

 

nickellis74_0-1621932767307.png

Thanks to Matt at D365 geek for this!

View solution in original post

2 REPLIES 2
amitprajapati
Frequent Visitor

Hi @nickellis74 ,

 

Please see my below suggested solution:

Step:1  Initialize the variable and store the incoming label in the variable as string

amitprajapati_4-1621667435110.png

 

 

Step 2: Create a Master object in which you have key as label and value as option set value using compose:

amitprajapati_5-1621667484705.png

 

Step 3: Get the Value of Option set based on key passed using below for formula and store it in another compose to use it further in flow:

Formula: outputs('Master_Lookup_Object')?[variables('Incoming Variable')]

amitprajapati_7-1621667575950.png

 

 

 

Output:

amitprajapati_3-1621667366372.png

 

Hope this helps!

 

Do like the answers if solution is correct

 

nickellis74
Resolver I
Resolver I

Thanks @amitprajapati for the help. My concern with this approach is that it hard codes the values, and sadly they tend to change - or at least be added to - fairly regularly.

 

After a bit of blog hunting, I came up with the following approach. It is heavily based on this blog: Updating Dataverse Optionset/Choice from Text dynamically using Power Automate (d365geek.co.uk)

 

nickellis74_0-1621932767307.png

Thanks to Matt at D365 geek for this!

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (45,210)