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


Dynamics SDK Fault Errors

Recently I was running some code against the Dynamics SDK that was taking a significant amount of time to run (transferring of data).  In my naivety, I had thought that by constantly doing “something” on that live connection my token would be refreshed.

Not the case.

It seems tokens from the Dynamics SDK are set at the time of connection and kept for the duration of the connection and not updated until you do so again.

To avoid having my connection cut during this migration (which was bad), I added some logic to check when the connection had last logged in, do a quick comparison of X minutes (in my case I chose 90 minutes but it could be more) and triggered a reconnect/refresh of my token.

The code is nothing spectacular, but understanding

Read More