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);
string configResults = config.Init();

CreateProgressItem(“Validate Base Configuration”);

if (!config.HasErrors)
RaiseUpdateEvent(configResults, ProgressPanelItemStatus.Complete);
RaiseUpdateEvent(“Could not create Base Configuration, Error: ” + configResults, ProgressPanelItemStatus.Failed);
The only differences from the above example are that I use what’s called the CreateProgressItem to create a unit of work to be done and when I’ve completed my task I use the RaiseUpdateEvent to show whether it created successfully or failed (and why).

From a user deployment perspective, this is a great experience as they get some insight into what has been done and what hasn’t before proceeding onto their next tasks.


I could use some “warnings” too but for now pass/fail works very well together.

Post A Reply

%d bloggers like this: