Cannot Delete Component in Dynamics 365

Roshan Mehta, 24 June 2020

If you’re like me and have been working with Dynamics 365 for many years, you’ll know all about dependent components. Or at least you think you do!

I wanted to delete a lookup field on a custom entity called Reimbursement. Of course, I had removed the lookup from the form, any views and checked all other dependencies, but I’d still see the Cannot Delete Component error when trying to delete the lookup.

image

Because I’m old school, I clicked on the OK button and then selected the Show Dependencies button to see if I had missed anything. The only dependency that appeared was the relationship that is part of the lookup that I’m trying to delete. This looked fine to me because the relationship would automatically be deleted when the lookup field is deleted. There was also nothing listed under Required Components and nothing useful in the error log. So, what’s the problem then?

image

I thought I’d check for any dependencies on the relationship itself, but there was nothing listed there either.

image

It turns out that I hadn’t followed my own advice of reading the error message clearly. The Cannot Delete Component error shows a little hyperlink on the word Details. If you click on this hyperlink, it brings up a window which shows you the actual dependency that is preventing you from deleting the lookup. In this situation, it was a rollup field on the parent record which was using the lookup in its condition.

image

image

Removing the lookup field from the rollup field condition solved the problem and allowed us to delete the field.

You’re probably thinking that it’s an obvious fix, but it might be something that is easily overlooked so hopefully this saves you some time!