As Microsoft is providing us more flexibility with Power Automate (MS Flow), now we can retrieve List of solution details and their components directly within Power Automate flows.
Recently, we got a requirement to retrieve the list of solutions and their components from specific environments and store this information in an Excel file on SharePoint.
We can achieve this using Solution and Solution Components entity records in Dynamics CRM.
Below are the steps to achieve this requirement.
Step 1: Initialize the Array variable
This array variable should include the details of the solution component types you want to retrieve from the solution, as shown in the screenshot below.
The above array contains the following details of the solution component types:
- ComponentType – The type value of the component from the documentation.
- EntityName – The logical name of the component type.
- FilterRowName – The field name to filter the component type.
- SelectColumn – The field name to filter the component type.
You can find all solution component types information in Microsoft Documentation
Step 2: Retrieve solutions
Add the ‘List rows from selected environment’ step to retrieve the solutions from the specific environment. Use a filter query to retrieve the visible solutions and exclude the default solution.
Step 3: Retrieve Solution Components
Now, proceed to retrieve the solution component for the previously obtained solution. Utilize an ‘Apply to Each’ step to iterate through each solution, and within that, add a ‘List rows’ action to retrieve the solution component using the filter rows.
Step 4: Filter Array step to check the Component Type
For each solution component, implement an ‘Apply to Each’ loop. Inside this loop, use a Filter Array step to check that the Component Type of the current solution component matches the type specified in the array variable we set up earlier.
Expressions from the above image:
- variables(‘SolutionCompentSummary’)
- @item()[‘ComponentType’]
- items(‘Apply_to_each_Solution_Components’)?[‘componenttype’]
Step 5: Retrieve Solution Components Summary
Add the ‘List rows’ step to retrieve the solution component if the Component Type matches and add a row into the Excel table.
Expressions from the above image:
- length(body(‘Filter_Solution_Component_Summaries’))
- body(‘Filter_Solution_Component_Summaries’)[0][‘EntityName’]
- body(‘Filter_Solution_Component_Summaries’)[0][‘FilterRowName’]
Expressions from the above image:
- items(‘Apply_to_each_Solutions’)?[‘uniquename’]
- items(‘Apply_to_each_Solutions’)?[‘createdon@OData.Community.Display.V1.FormattedValue’]
- items(‘Apply_to_each_Solutions’)?[‘version’]
- items(‘Apply_to_each_Solutions’)?[‘ismanaged@OData.Community.Display.V1.FormattedValue’]}
- outputs(‘List_of_Solution_Component_Summary’)?[‘body/value’][0]?[body(‘Filter_Solution_Component_Summaries’)[0][‘SelectColumn’]]
- concat(toUpper(take(replace(string(outputs(‘List_of_Solution_Component_Summary’)?[‘body/value’][0]?[‘@odata.type’]), ‘#Microsoft.Dynamics.CRM.’, ”), 1)), toLower(skip(replace(string(outputs(‘List_of_Solution_Component_Summary’)?[‘body/value’][0]?[‘@odata.type’]), ‘#Microsoft.Dynamics.CRM.’, ”), 1)))
Conclusion:
By following these steps, you can retrieve Solutions and their component details using Power Automate flow.
From customizing Microsoft Dynamics 365 to developing Copilot-enabled Power Platform Apps, our outsourced development services ensure top-notch solutions tailored to your needs. Let our experts handle the technicalities while you focus on your core business. Email us at crm@inogic.com to get started today.