Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Get Choice field Text in Power Automate from Microsoft DataVerse/CDS

Get Choice field Text in Power Automate from Microsoft DataVerse/CDS

Working with Power Automate is not new but sometimes the out-of-the-box value assignment is not sufficient to get correct data items so we need to tweak the expression to get the correct result.

In this post I will explain how you can get the choice field text value in power automate. let us say I want to get the Lead Source from Lead entity and store in a variable then If I will just assign the Lead Source value to the variable using Dynamic panel then it will just display the value for the choice field. As below screenshot it only displays the value.

The above flow will just assign the Lead Source Choice value field as 1. As you can see in the Run History.

But my intention is to assign text field of the Lead Source so for this we need to add some code in expression.

To identify what should you use to get the text field you have to check the output generated for the “Get Row By Id” step in run history. Go to run history and open the last run instance.

Now click on the step which retrieves the entity records for my case it is “Get a Row By Id”. Copy the Entire Body field and copy to a notepad of your choice.

Now there search your desired field for my case it is “leadsource”. You can see a section where your field is there in the notepad you can mark it that the leadsourcecode has two statements. one is for value and another is for text.

So to get the text e have to use the below expression format.

leadsourcecode@OData.Community.Display.V1.FormattedValue

Like that all choice field will have the same syntax. Now let us go and update our flow. Go to the step where you assign the field and use Peek Code to check the code generated.

The code will look like the below. For Lead Source the value property is assigned as below.

"value": "@{outputs('Get_a_row_by_ID')?['body/leadsourcecode']}"

Now we will copy the code for value and reframe using Formatted value syntax as below.

outputs('Get_a_row_by_ID')['body/leadsourcecode@OData.Community.Display.V1.FormattedValue']

Now go to flow and click Done to switch to Design mode and delete the value Lead Source assignment rather add our reformatted code as below using expression .

Now test this and check the variable value. Now you can see the Text value appears.

I hope this helps you.

Follow and subscribe my site and YouTube channel.

You can enroll now !We are giving 30% discount on our Internship Program

Don’t miss the chance to participate in the upcoming Internship Program which will be done using Microsoft Dot Net Web Development Full Stack Technology. The new batch will be starting from May 20, 2024.  We will have most experienced trainers for you to successfully complete the internship with live project experience.

Why to choose Our Internship Program?

Industry-Relevant Projects
Tailored Assignments: We offer projects that align with your academic background and career aspirations.
Real-World Challenges: Tackle industry-specific problems and contribute to meaningful projects that make a difference.

Professional Mentorship
Guidance from Experts: Benefit from one-on-one mentorship from seasoned professionals in your field.
Career Development Workshops: Participate in workshops that focus on resume building, interview skills, and career planning.

Networking Opportunities
Connect with Industry Leaders: Build relationships with professionals and expand your professional network.
Peer Interaction: Collaborate with fellow interns and exchange ideas, fostering a supportive and collaborative environment.

Skill Enhancement
Hands-On Experience: Gain practical skills and learn new technologies through project-based learning.
Soft Skills Development: Enhance communication, teamwork, and problem-solving skills essential for career success.

Free Demo Class Available