Whenever we do a solution migration or deployment, it is of utmost importance that we perform certain pre-deployment and post-deployment checks. One of these checks is to validate if all the components have been successfully migrated or not to the target environment. Today, we will use PowerShell script to fetch a list of all the components within a specific solution. This script can be modified to perform comparison between the source and target solutions and help automate the process during validation.
The Solution Component Table is a foundational element in Microsoft Dataverse that provides detailed insights into the individual components of a solution. Solutions in Dataverse are containers for apps, entities, workflows, and other resources that are packaged together for deployment and management. The Solution Component Table acts as a registry, cataloging all components within a solution and their interdependencies.
This table empowers developers, administrators, and architects to manage solutions effectively by offering a granular view of their components. Whether you’re troubleshooting, auditing, or preparing for deployment, the Solution Component Table can be a valuable tool in your toolkit.
The Solution Component Table contains the following key fields:
Understanding these fields is crucial for leveraging the table effectively.
By querying the Solution Component Table, you can retrieve a comprehensive list of all components within a specific solution.
Example Script:
I have a solution called My Blog Components with solution ID a7536908-113b-f011-877a-7c1e52328e88. Lets get the list of components in this solution.
#Script
# Authenticate with Dataverse
$connection = Connect-CrmOnline -Username james@personal.onmicrosoft.com -ServerUrl "org2afa465b.crm8.dynamics.com"
# Define the FetchXML to query the Solution Component Table
$fetchXml = @"
<fetch>
<entity name="solutioncomponent">
<attribute name="componenttype" />
<attribute name="createdby" />
<attribute name="createdon" />
<attribute name="ismetadata" />
<attribute name="modifiedon" />
<attribute name="objectid" />
<attribute name="rootsolutioncomponentid" />
<attribute name="solutioncomponentid" />
<attribute name="solutionid" />
<filter>
<condition attribute="solutionid" operator="eq" value="a7536908-113b-f011-877a-7c1e52328e88" />
</filter>
</entity>
</fetch>
"@
# Execute the FetchXML query
$results = Get-CrmRecordsByFetch -Fetch $fetchXml
$results.CrmRecords | ForEach-Object {
[PSCustomObject]@{
SolutionComponentId = $_.solutioncomponentid
ComponentType = $_.componenttype
ObjectId = $_.objectid
CreatedOn = $_.createdon
}
} | Format-Table -AutoSize
This script connects to Dataverse, retrieves all components within a specific solution, and outputs their details. Here’s how it works:
Connect-CrmOnline
command with OAuth credentials to establish a connection.solutioncomponentid
, componenttype
, solutionid
, etc.).Get-CrmRecords
ByFetch command runs the FetchXML query against Dataverse.SolutionComponentId
, ComponentType
, ObjectId
, and CreatedOn
) for each component.Expected output: 3 components – 1 canvas app, 1 power automate flow and 1 connection reference.
Script Output:
You can filter components by their type using the ComponentType field. For instance, if you only want to list Canvas Apps (Component Type value 300) only within the solution, we can modify the script as below:
(Note: ComponentType values correspond to specific component types; consult this MS documentation for the complete list.)
Example Script:
# Authenticate with Dataverse
$connection = Connect-CrmOnline -Username james@personal.onmicrosoft.com -ServerUrl "org2afa465b.crm8.dynamics.com"
# Define the FetchXML to query the Solution Component Table
$fetchXml = @"
<fetch>
<entity name="solutioncomponent">
<attribute name="componenttype" />
<attribute name="createdby" />
<attribute name="createdon" />
<attribute name="ismetadata" />
<attribute name="modifiedon" />
<attribute name="objectid" />
<attribute name="rootsolutioncomponentid" />
<attribute name="solutioncomponentid" />
<attribute name="solutionid" />
<filter>
<condition attribute="solutionid" operator="eq" value="a7536908-113b-f011-877a-7c1e52328e88" />
</filter>
<filter>
<condition attribute="componenttype" operator="eq" value="300" />
</filter>
</entity>
</fetch>
"@
# Execute the FetchXML query
$results = Get-CrmRecordsByFetch -Fetch $fetchXml
$results.CrmRecords | ForEach-Object {
[PSCustomObject]@{
SolutionComponentId = $_.solutioncomponentid
ComponentType = $_.componenttype
ObjectId = $_.objectid
CreatedOn = $_.createdon
}
} | Format-Table -AutoSize
Expected Output: 1 component i.e. 1 canvas app
Script Output:
The Solution Component Table is a powerful resource within Dataverse that enables comprehensive solution management. By leveraging its capabilities through PowerShell scripts, you can streamline development, ensure robust deployments, and maintain the integrity of your applications. Start exploring the Solution Component Table today to unlock its full potential!
Check James Yumnam’s original post https://jamesyumnam.com/2025/05/28/find-the-solution-components-in-a-specific-solution/ on jamesyumnam.com which was published 2025-05-27 19:47:00