Power Automate Fundamentals # 43: Extract Choice Text Value in Power Automate

Introduction:

In Power platform for some requirements, it is required to extract Choice values for entities. As an example, on update of Contact record, Status [Choice] Text Value will be extracted .

Step 1:

Login to the required Power Apps environment using URL make.powerapps.com by providing username and password and click on Flows on the left-hand side as shown in the below figure.

Step 2:

After Step 1, Click on New Flow and select automated cloud flow and choose the trigger as when a row is added. Modified or deleted under Dataverse Connector and click on Create as shown in the below figure.

Step 3:

After Step 2, name the flow as Extract Choice Text Value and step as When a row is added, modified or deleted [Contact CRUD] with the following values as inputs

Change type : Added or Modified or Deleted

Table name : Contacts

Scope : Organization

as shown in the below figure.

Step 4:

After Step 3, take new step and select Dataverse Connector and under Dataverse select action Get a row by ID and name the step as Get a row by ID [Retrieve Complete Details of Selected Contact] and select Table Name ,Row ID under step When a row is added, modified or deleted [Contact CRUD] with the following values as inputs

Table name : Contacts

Row ID : Contact

 {triggerOutputs()?[‘body/contacted’]}

as shown in the below figure

Step 5:

After Step 4, run the flow and copy the body part which is present in Output of Step Get a row by ID[Retrieve Complete Details of Selected Contact] and keep it in the notepad to use in next step as shown in the below figure.

Step 6:

After Step 5, take Parse JSON action and name it as Parse JSON [ Parse Contact Details into JSON]  and provide the inputs as

Content : body body(‘Get_a_row_by_ID_[Retrieve_Complete_Details_of_Selected_Contact]’)

And click on Generate from Sample button and paste the content which was copied in Step5 and click on Done as shown in the below figure.

After click on Done , Parse JSON Step looks like below figure.

Step 7:

After Step 6, take Compose action and name it as Compose – Extract Status Code and provide the inputs as

Inputs : Status :  body(‘Parse_JSON_[_Parse_Contact_Details_into_JSON]’)?[‘statecode@OData.Community.Display.V1.FormattedValue’]

as shown in the below figure.

Step 8:

After Step 7, just save and run the flow and go to any contact record and update record and you should observe the result as shown in the below figure.

Note:

  1. Make sure to save and run the flow whenever you try expressions.
  2. Make sure to keep copy the output of Get a row by ID [Retrieve Complete Details of Selected Contact] cautiously and paste it on Generate Sample Json step to extract the schema of the data to use it in the next step without fail.

Conclusion: In this way we can extract Choice Text value during update of a table using Power Automate Flow easily.

One thought on “Power Automate Fundamentals # 43: Extract Choice Text Value in Power Automate

  1. Pingback: Rewind December 2021 – Common Man Tips for Power Platform, Dynamics CRM,Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s