Introduction
In this article, we will discuss how we can get option set value in Microsoft Flow using String Map entity.
Requirement
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.
Solution
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.
- Navigate to Flow from your office 365 or from Dynamics 365 apps menu and click on Create from the blank space.
- 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,
- Click on the file picker and select root folder where we will be uploading the file.
- Now, let’s create a variable where we will store the returned value. Click on "+ New Step" and select "Add an action".
- Type variable in the search text field and select Variables. After that, select "Initialize variable" action.
- Let’s name this variable as RelationshipType.
- 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.
- Set "Get Rows" action details like following. Here, HIMBAP is the name of the table in the Excel import file.
- Now, "add an apply to each" to process the records from the Excel file.
and configure it like following
- 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.
- 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!