Get Option Set Value Based On Label In Microsoft Flow


In this article, we will discuss how we can get option set value in Microsoft Flow using String Map entity.


Let’s say we need to process one import file which will be available in one drive for business and we want to get option set value of relationship type label available in the RelationshipType column.



In my earlier article, we discussed how we can use String Map entity to get option set label based on its value using Web API. We can also use String Map entity to get option set value based on its label. We can use the following steps.
  1. Navigate to Flow from your office 365 or from Dynamics 365 apps menu and click on Create from the blank space.
  2. We will be using One Drive for Business trigger -- when a file is created, select One Drive for Business and select the "Create file" trigger like the following,

  3. Click on the file picker and select root folder where we will be uploading the file.

  4. Now, let’s create a variable where we will store the returned value. Click on "+ New Step" and select "Add an action".

  5. Type variable in the search text field and select Variables. After that, select "Initialize variable" action.

  6. Let’s name this variable as RelationshipType.

  7. Now, we need to use the "Get Rows" action from Excel. Click on "+ New Step" and select "Add an action". Type Get Rows in the text field and select "Get Rows" action.

  8. Set "Get Rows" action details like following. Here, HIMBAP is the name of the table in the Excel import file.

  9. Now, "add an apply to each" to process the records from the Excel file.

    and configure it like following 

  10. Click on "+ New Step" and select "Add an action". Type Dynamics 365 and select the "List records" action. We need to configure it like following.

    Here, relationship type is the name of the column in the Excel file.

  11. Now finally, we can add "Apply to each" step for List records to parse the result and assign the result to our variable like the following.

Now, our flow is ready for the test. When we upload our Excel file to One Drive for Business, our flow will run and we can see the output returned like below.


Stay tuned for more Dynamics 365 content! 

We are expert in Microsoft Power Platform.