Mar 25, 2018

Continuous Integration (CI) for Dynamics 365

DevOps being very popular among developing arena, Continuous Integration (CI) has become very important aspect. Though you will find many articles on theoretical approach on CI, guide on how to do it for a XRM is still rare. In fact, thought of sharing one approach tried recently.

Here I am explaining a working skeleton of my choice for D365 V9. I am not going in-depth in VSTS (Visual Studio Team Services) online Build and Release process, but explain D365 specific work, which is the focus.

CI for D365 needs utilising of collection of tools together. In this example, I am deploying a Package consist of a Solution as well as a Data file.

1) Package Deployer – to Create Package

Here I am using Package Deployer of D365 SDK.  Below Videos explain standard usage of Package Deployer;

a. Create Package: https://www.youtube.com/watch?v=KJKZPu4C-O4
b. Deploy Package: https://www.youtube.com/watch?v=lKt-bPdiBgM&t

Usually, Package is deployed through supplied wizard based steps, but we need to automate the deployment process. Still structure of the package and the way It’s being created remains same.

According to our scenario, we define Package with one Solution and a Data file resulting below Config file;


A couple of points;

• Solution component is required, though data file is optional.  Suppose our requirement is to push only the data file, still a dummy solution needs to be there.

• If the Solution is already deployed to D365 and we try to push it with same version, importing of the solution is skipped.

If you want to deep dive in to Package Deployer, please refer below article.
https://msdn.microsoft.com/en-us/library/dn688182.aspx

2) Configuration Migration Tool – to Create Data Files

Configuration Migration tool, supplied by SDK, is to be used to generate the Data file explained in step 1.

This explains how this tool should be used;
https://www.youtube.com/watch?v=_DrDbfRlJZI

3) Prepare VSTS Online

In our, scenario we use xRM CI Framework as an add-in.  Below simple steps illustrate how it can be added to VSTS;

a. Browse to Market Place of VSTS

b. Search for Xrm and click Get it free

c.You are done.


4) Build Process

Build definition is simple and consist of only one Task which is Publish Artefact task.


One point to keep in mind is, I have kept package in correct structure in BuildPath folder.


Once built, published artefacts are in the same correct structure in Artefacts Explorer as shown below;

5) Release Process

In Release definition, we use MSCRM Package Deployer task provided by xRM CI Framework. Within the relevant configuration, you will notice how I have pointed the Assembly of the package and Package directory to the build Artefacts we built in previous step.


Anyway, by the time this writting, this works only if Crm SDK Version is set to 8.2. If I find more about this issue or workaround, will publish in this blog in future.

Happy days!.. Releases are happening..


Now your package is pushed to Dynamics 365.

Mar 9, 2018

Cannot Delete Entity – Invisible Form Dependency

Once we remove all the possible dependencies for an Entity, we are allowed to Delete it in Dynamics 365. Once in a while it doesn’t behave as expected. I faced one such case recently.  Though I removed every possible/visible dependency, I couldn’t delete the Entity (say Region, new_region). It shows me some more Form dependencies.

In such case, what you need to do is create a Temporary Solution and add only the Entity that Form belongs to, Import it, Unzip and Open Customization.xml in readable editor. Now search for the Entity Schema name (i.e. new_region) you need to delete. Most probably, you will find section like below.


Explanation
This means dependency is on one of the Filter of lookup fields within that Form. If you browse to the customisation of that Form you will see particular Lookup Filter is not even enable. My hunch is, previously this Lookup filter may have been configured to filter by the relationship with the entity we are going to delete. This <DependentAttributeType> tag may not have been removed once disabling the Filter of the lookup or even when deleting the relationship.

How to Fix
Enable the Lookup filter and set a different filed (ex. By Owner) and publish. Then this troublesome tag will be replaced with this new type. Now we can delete our Entity. Now you can disable the Filtered lookup as necessary.