Customer Engagement & Dynamics CRM Forum

 View Only
  • 1.  Synchronization Between Dev, Test and Production environments

    Posted 13 days ago
    Edited by Grace Jensen 13 days ago
    We have the following environments. We are in the process of consolidating our solutions into a master solution and creating patches for any future enhancements. In the effort to consolidate our solutions we are deleting unused components. In our managed environments this is happening as part of deleting the base solution where the component was created. However, in our unmanaged development environment, my understanding is we have to delete the solution and then find and delete the component from the default solution. Has anyone else solved this scenario? We have close to 1,000 components that need to be deleted and are trying to find the most efficient way to accomplish this. Thanks in advance for any advice!

    Development: unmanaged
    Test: managed
    Production: managed

    ------------------------------
    Grace Jensen
    Section Manager
    Burns & McDonnell
    ------------------------------


  • 2.  RE: Synchronization Between Dev, Test and Production environments

    TOP CONTRIBUTOR
    Posted 12 days ago
    Some early morning thoughts...
    Deleting the managed solutions will result in loss of data if any tables or columns are in the solution.
    It will also likely not be possible to just delete these solutions, as there will be dependencies with objects in other solutions.
    I think you should forget about these managed solution environments - see below for what to do.

    Firstly, I would use the existing unmanaged solutions to assist you in deleting the objects you no longer need - you can delete them from the environment from the unmanaged solution - you do not have to do this from the default solution.
    Deleting the unwanted objects will require you to remove any dependencies that will prevent you from deleting the objects - this is doable but will take time. Use the classic solution view for this, as the Dependencies view includes a link the to the other objects that you need to delete or edit to be able to delete the object (the new dependencies view in the modern solution editor does not yet include this link).

    Once you have your new master solution, I suggest that you install it in a new production environment and migrate the data from the existing production site. Data migration is non-trivial, and the scope depends on the number of tables and relationships involved, but I am pretty sure that it will be easier than trying to fix a bunch of managed solutions. There are tools to assist with this.
    Also, I suggest that you just create a new test environment and install your new managed solution there.

    ------------------------------
    Donal McCarthy
    Digital Marketing Administrator
    BrightWork
    Galway
    ------------------------------



  • 3.  RE: Synchronization Between Dev, Test and Production environments

    SILVER CONTRIBUTOR
    Posted 11 days ago
    Hi Grace,

    As Donal explained, deleting a managed solution will delete data in your environment so be careful.

    With regards to unmanaged solution, deleting an unmanaged solution will not delete the components and customizations in the environment. I suggest that you keep all your solutions for now and create a new one and consolidate all your customizations. You will be prompted about the dependencies before deleting any component. Make sure to not delete any views that were auto-created when you created the table such as the associated view, that will give you unnecessary errors.

    If you do not have any data in your managed environment, then its okay to delete managed solution and install the cleaner version of your solution from DEV (tested in TEST).

    However, if you have data, then deleting managed solution, will delete the data especially if you have custom tables on your managed solution. One thing you can do is to perform a solution upgrade from DEV to PROD. That will push any deletion in DEV to PROD.

    ------------------------------
    Cristall Amurao
    Solutions Architect
    Oshawa ON
    ------------------------------



  • 4.  RE: Synchronization Between Dev, Test and Production environments

    Posted 11 days ago
    Hi, if you are consolidating solutions into one master solution then in your dev domain computer create a new solution and put all of your components in it. This assumes you have all the unmanaged solutions available.
    Once the solution is complete you can export / import into the next environment, and remove the previous solutions.
    Data is retained for entity attributes that remain.

    When the master solution is available you don't have to delete any unused components simply create a new instance of D365 and import the unmanaged master solution.

    regards
    Arthur Vlachos

    ------------------------------
    ARTHUR VLACHOS
    HaG Software Solutions
    ------------------------------



  • 5.  RE: Synchronization Between Dev, Test and Production environments

    TOP CONTRIBUTOR
    Posted 10 days ago
    When you say "components" are you referring to deleting Attributes within Entities?

    If that is the case, it is a relatively easy thing to do to set up a Console Application in Visual Studio and iterate through a list of Attributes and delete them.

    I tend to like reading from an Excel File, but you can set up lists within the Application, or even iterate through ColumnSets.

    // Delete all attributes created for this sample.
    foreach (attributeRow in addedAttributes)  // <--  This is a poorly constructed for loop without proper naming
    {
    DeleteAttributeRequest deleteAttribute = new DeleteAttributeRequest {
    EntityLogicalName = (string)attributeRow[TableName],
    LogicalName = (string)attributeRow[AttributeSchemaName]
    };

    svc.Execute(deleteAttribute);    // Execute the request
    }


    As a clearer example, I will set up a Request for a custom field in the "account" entity:

    DeleteAttributeRequest deleteAttribute = new DeleteAttributeRequest {EntityLogicalName = "account", LogicalName = "new_region"};

    svc.Execute(deleteAttribute);    // Execute the request


    I would put a try-catch around "svc.Execute" to capture misnamed attributes or attributes that still have dependencies on them.  I would also output the results to a text file within a "Using" Method by inserting Console.WriteLine("") statements within the foreach loop to document each Delete.  I didn't include all of the logic to try to keep the concept fairly simple.

    You can read more information in the Sdk Documentation here:

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.deleteattributerequest?view=dynamics-general-ce-9


    ------------------------------
    Gerry Yurko
    CRM Developer
    Crown Castle Fiber Networks
    Boxborough MA
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role