web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Get all compenent with Active layer

(2) ShareShare
ReportReport
Posted on by 94

Hello,

We have an objective to delete automatically all Active layer in our managed environements (staging and production environment).
Or if it's possible to do a manually delete of active layer in the compenents (by knowing the components upstream).

For information, we already did our import with managed solution without update in the customisation.

For Automatic delete:

Is it possible to delete all active layers in a managed environment?

For manual Delete :

So is it possible to do an API call to get all component with the active layer?
Or it's possible to get all components with specific a publisher (related to the active layer)?


Best regards,

I have the same question (0)
  • LenCRM Profile Picture
    25 on at

    Did you ever find an answer to this question?  I'm hoping to identity all components with an active layer as well.

  • Suggested answer
    Joergen Profile Picture
    455 on at

    Hi LenCRM,

    are you familiar with the XRMToolbox developed by MVP Tanguy Touzard and other community developers? In the list of tools you  will find the "Solution Layers Explorer" to search for active layers and the "Unmanaged Active Layer Bulk Remover".


    pastedimage1647903710232v1.png

    Maybe you can try these tools in a test environment to verify if these tools provide the results/solutions you are looking for.

    If this has been helpful for you, please mark as verified.

    Best regards,

    Joergen


     

  • Suggested answer
    Florent@Inetum Profile Picture
    14 on at
    Hello,
     
    The table for component layers is called msdyn_componentlayer. But it seems that a security is put on this table when querying it. The only way to fetch data from it is to condition the query on both the component id (msdyn_componentid) and component type (msdyn_solutioncomponentname) hence why you cannot query this table using joins and that the tools presented in previous answers are doing the requests in loops.
     
    Gladly, Mark Carrington's tool SQL4CDS is really powerful and allow us to use Cursors and lets ourselves loop queries without the need to develop a .net app.
     
     
    Furthermore, mister Carrington provided us a great documentation: https://github.com/MarkMpn/Sql4Cds/wiki

    Here is an exemple of SQL code that can be used to fetch the layers of components:
    CREATE TABLE #temp_components
    (
        msdyn_componentid UNIQUEIDENTIFIER,
        msdyn_name NVARCHAR(256),
        msdyn_solutioncomponentname NVARCHAR(256),
        msdyn_order INT,
        msdyn_publishername NVARCHAR(256),
        msdyn_solutionname NVARCHAR(256)
    );
     
    DECLARE @ComponentID AS NVARCHAR(256);
    DECLARE @ComponentType AS NVARCHAR(256);
     
    DECLARE Component_Cursor CURSOR
    FOR
        SELECT DISTINCT c.objectid, c.componenttypename
        FROM solutioncomponent c
        JOIN solution s ON c.solutionid = s.solutionid
        WHERE s.publisheridname like '<Publisher>' ;
       
    OPEN Component_Cursor;
     
    FETCH NEXT FROM Component_Cursor INTO @ComponentID, @ComponentType;
     
    WHILE @@FETCH_STATUS = 0
    BEGIN
        INSERT INTO #temp_components(msdyn_componentid, msdyn_name, msdyn_solutioncomponentname, msdyn_order, msdyn_publishername, msdyn_solutionname)
        SELECT cl.msdyn_componentid, cl.msdyn_name, cl.msdyn_solutioncomponentname, cl.msdyn_order, cl.msdyn_publishername, cl.msdyn_solutionname
        FROM msdyn_componentlayer cl
        WHERE msdyn_solutioncomponentname = @ComponentType AND msdyn_componentid = @ComponentID;
     
        FETCH NEXT FROM Component_Cursor INTO @ComponentID, @ComponentType;
    END;
     
    CLOSE Component_Cursor;
    DEALLOCATE Component_Cursor;
    GO
     
    SELECT * FROM #temp_components;
    DROP TABLE #temp_components;
    This is my code with it's impurities so be free to adapt it to your need.
    Be careful, some of the Component Type names in solutioncomponent.componenttype name are not recognized/same in msdyn_componentlayer.msdyn_solutioncomponentname like 'Saved Query' and will fail the execution.
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    7,835 Super User 2025 Season 2 on at
    Hello feninzie,
     

    You're right to be concerned about active layers in your managed environments. They can lead to unexpected behavior and make it harder to manage your solutions over time. Unfortunately, directly and automatically deleting all active layers in a managed environment isn't a straightforward, built-in feature of Power Platform.

     

    Here's a breakdown of what's possible and the approaches you can take for both automatic and manual removal:

    For Automatic Deletion of All Active Layers (Not Directly Possible):

    • No Built-in "Delete All Active Layers" Functionality: Power Platform doesn't provide a single button or automated process to globally remove all active customizations across all components in a managed environment. This is by design to prevent accidental data loss or unintended consequences.
    • Potential Risks of Automation: Automatically deleting active layers without understanding their origin and purpose could break existing customizations or integrations.


    •  

    For Manual Deletion of Active Layers:

    You have a few options to identify and manually remove active layers from individual components in your managed environments:

    1. Using the Solution Layers Feature in the UI (Recommended for Manual Inspection):

      • Navigate to Power Apps (https://www.google.com/search?q=make.powerapps.com) or Power Platform Admin Center.

      • Go to Solutions.

      • Select your Managed Solution.

      • For each component within the solution (e.g., Table, Column, Form, View, etc.):

        • Click the "..." (More actions) next to the component.

        • Select "See solution layers".

        • This will show you a list of all layers for that component, including the active layer (if one exists).

        • If an active layer exists and you understand its purpose and want to remove it:

          • Click the "Remove active customizations" button (it looks like a trash can) next to the "Active" layer.

          • Confirm the removal. 
           

      • Identifying Components with Active Layers: Unfortunately, there isn't a direct view or dashboard in the UI that lists all components with active layers across your entire environment. You would need to inspect components within your managed solutions individually

          


    2. Using the Power Platform CLI (Recommended for Scripting and Automation of Identification):

      The Power Platform CLI (pac) provides commands to interact with solution layers programmatically. This is a more efficient way to identify components with active layers, which you can then potentially use to script the removal (though direct automated removal of all is still risky).

      • List Solution Layers for a Component:

        You'll need to know the logical name and component type code for each component.


      • List Components with Active Layers (More Complex Scripting Required):


        You would need to iterate through all components in your managed solution and then use the get-layer command to check if an "Active" layer exists. This would involve scripting using PowerShell or another scripting language.


      • Remove Active Layers (Use with Caution and Targeted Approach):

        pac solution remove-layer --solution-name <your_managed_solution_name> --component-logical-name <component_logical_name> --component-type <component_type_code>

        Important: Use this command with extreme caution and only on specific components where you understand the impact of removing the active layer.


      • Getting Component Information: You can use other pac solution commands to list components within a solution, which you can then iterate through.

    3. Using the Power Apps API (More Technical):

      You can use the Power Apps API (part of the Dynamics 365 Web API) to interact with solution components and layers.

      • Retrieve Solution Components: You can query the solutioncomponent entity to get a list of components within your managed solutions.

      • Retrieve Solution Layers for a Component: You would likely need to use custom API calls or potentially leverage SDK methods to retrieve the solution layers for each component and identify the active layer. This is more complex than using the CLI.

      • Removing Active Layers via API: There isn't a direct, simple API call to remove an active layer. You would likely need to perform updates or potentially use internal, unsupported API endpoints (which is strongly discouraged).


      •  

    4.  

    Answering Your Specific Questions:

    • Is it possible to delete all active layers in a managed environment? No, there isn't a direct, automated way to delete all active layers. You need to identify and remove them on a component-by-component basis.

    • So is it possible to do an API call to get all components with the active layer? Yes, it's possible, but it requires more effort. You would need to:

      1. Retrieve all components within your managed solutions using the Power Apps API or CLI.

      2. For each component, retrieve its solution layers using the API or CLI.

      3. Parse the results to identify components that have an "Active" layer. 

    • Or it's possible to get all components with a specific publisher (related to the active layer)? Yes, this is also possible but requires more investigation. The active layer doesn't inherently have a specific publisher associated with it in the same way a managed solution does. The active layer represents unmanaged customizations on top of the managed layers.

      You could potentially:

      1. Retrieve all components with active layers (as described above).

      2. For each of those components, examine the details of the active customizations (if you retrieve them) to see if they were created by a specific user or within a specific timeframe that might correlate with a particular unmanaged customization effort. However, this isn't a direct link to a publisher.


      3.  

    •  

    Recommendations:

    1. Prioritize Manual Review using the UI: For understanding the active layers and their purpose, the "See solution layers" feature in the UI is invaluable.
    2. Leverage Power Platform CLI for Identification and Targeted Removal: Use the CLI to script the identification of components with active layers. This can be more efficient than manually checking every component.
    3. Exercise Extreme Caution with Removal: Before removing any active layer, understand what customizations it contains and who might have made them. Removing active layers can have unintended consequences.
    4. Establish Governance Practices: Implement clear governance practices around making unmanaged customizations in managed environments to prevent the accumulation of active layers in the future.

    5.  

    By combining manual inspection with the power of the Power Platform CLI, you can effectively identify and manage the active layers in your managed environments. Remember to proceed with caution when removing them.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans