Note: this solution was updated to v 1.0.1 on Aug 9. Instead of the original workflow activity, there is a plugin and an SDK step now. It turned out custom workflow activity was causing Generic SQL Errors in some environments.
If you just asked “what?!” after reading the title, I guess my mission has already been half accomplished. Catchy subjects and all that..
But, seriously, we don’t always have the luxury of automated deployment on our projects, so we often have to do a lot of stuff manually when maintaining Dynamics environments. And one of those things which I found causing a bit of a problem is making sure that all the attributes that were supposed to be deleted have, actually, been deleted.
As in.. While working in the sandbox environment, we may choose to delete an attribute. But we also need to remember to delete it from production when the time comes. And, of course, in the absence of automated deployment, deleting an attribute is, often, the last of our concerns since, after all, having an extra attribute is unlikely to break anything. And going over a bunch of attributes does take time.. not surprisingly, we may simply choose to keep them in production this time.. and the next time.. and, eventually, we won’t know what’s needed and what’s not anymore.
So, to make it a bit easier, what if we could list all deleted attributes in a spreadsheet, and, then, import that spreadsheet to the production environment? Of course it would not help much unless there were some code that would process the spreadsheet to actually delete the attributes.
This is exactly what “Solution Management” project is about:
Here is how it works:
2. With this solution, a few components will be deployed
- Solution Action entity
- A plugin and an SDK step registered to run OnCreate (pre-validate) of the Solution Activity
3. To use the solution, you would need to create Solution Action records in the production environments, so the workflow would take care of deleting the attributes. Using excel import might be one of the easiest options for that
- Start by downloading the import template for the Solution Action entity
- Open the spreadsheet and fill in the data – you only need to provide Action, Entity, and Attribute names
- This is important: make sure you have deployed the customizations which remove dependencies for the attributes being deleted. The workflow will not be deleting the dependencies – it will only try to delete the attribute. If this sounds like a limitation, think of it this way: assuming you are not using the attribute, there should be no dependencies. By this time, you would normally have worked through that while customizing the forms/views/charts/dashboards, etc. In other words, this is not something you need to do manually in production – you just need to bring over your customizations (as a solution) from sandbox/development to production.
- Finally, import the spreadsheet to Dynamics
You may want to give the workflow a few minutes to complete, since it’s a background workflow. And, then, you can go to the advanced find and have a look at the Solution Actions:
Believe it or not.. We’ve just deleted an attribute using Excel import!