Creating Code Tasks with the Package Deployer

Continuing off of last week’s Package Deployer post I needed to add some extra functionality into our deployment that required the configuration of some steps that we were doing manually but now wanted to be done in a more automated fashion.

The task to accomplish this isn’t too hard and can be done relatively easily.

The first step involves decided “where” you want your code to execute.  In my scenario, I wanted my code to Run after I had deployed all my customizations to the target tenant.  In my example, I am deploying a base configuration after everything has been deployed.  The “this.CrmSvc” is part of the runtime of the Package Deployer code which lets me access the current connection to Dynamics365.
//Implement the Default Configuration.
ValidateConfiguration config = new ValidateConfiguration(this.CrmSvc);
Read More


The Dynamics Package Deployer

I was looking to automate some of my solution deployments for customers to simplify the deployment of solutions into new environments and ensure the right steps were being followed pre and post deployment.

To do this I wanted to leverage the Package Deployer from Dynamics.  There is already some pretty good information on how to get started building your first package, however I ran into a few problems not covered in the documentation.

Cannot Connect to an Dynamics365 instance

There are many articles on this topic as it ranges from TLS to security permissions, however for me, it came down to SDK versions.  I generally work on a number of different instances across many customers and versions so I need to keep my versions strongly in check.  As such, when trying (and

Read More


Installing USD Package Solutions

I’ve been trying for the last few days to install the solutions for the Unified Service Desk (v4) on a brand new tenant.

Turns out this was much more complicated than I thought as I ran into the dreaded “Initializing Connections 1 of 5” error where the whole app pretty much hangs forever.

After awhile of staring at the problem, I realized this could be a problem with the Package Deployer not being able to handle MFA (even though it prompts you for the logins and everything).

Sure enough, I tried a new account and things worked fine.  The only issue I ran into as an after thought was the “multiple tokens in cache” issue which can be resolved here.

And finally got to this stage.

Read More


Patterns on Bulk Data Migration

No code in this most, well maybe a bit.

I’ve been working on a number of data migrations over the past few years using a variety of tools, from off the shelf solutions to home grown, I’ve run everything in between.

All of them have their hits and misses and this isn’t to harp on one over the other as I continue to refine my approach in getting data into Dynamics in the most efficient way possible.

My current investigation into how to optimize this process has lead me to consider what the most important pieces for a solution to work are;

  1. Make it As Fast As Possible.
  2. Being able to handle Concurrent Connections (i.e., multi-thread and parallelize it until the cows come home).
  3. Accessible in the environment that the user operates in (read: if you’re

    Read More


Bulk Delete with Dynamics365

No matter what project you are on, you are at one point or another going to need to delete data.

Your environment will become polluted and you going through each entity or manually queuing up your own delete jobs will not be worth your time.

To bulk delete your entire environment you can make use of the Bulk Delete API with the following lines of code.

QueryExpression bulkquery = new QueryExpression();
bulkquery.EntityName = entity.LogicalName;
bulkquery.Distinct = false;

BulkDeleteRequest request = new BulkDeleteRequest
{
JobName = String.Format("System Purge Requested for Entity [{0}] - All Records", bulkquery.EntityName),
QuerySet = new[] { bulkquery },
StartDateTime = DateTime.Now.ToUniversalTime(),
ToRecipients = new[] { currentUserId },
CCRecipients = new Guid[] { },
SendEmailNotification = false,
RecurrencePattern = String.Empty
};

ExecuteMultipleResponse response = new ExecuteMultipleResponse();
response = (ExecuteMultipleResponse)_svc.CrmService.Execute(multipleRequest);

Of critical importance is the

Read More