A saga on deleting objects in Dataverse
I am in a love-hate relationship with Dataverse. It is amazing most of the time and annoying, sometimes. While the object dependency feature is pretty neat and is a must to develop a meaningful and reliable solution, it becomes a hassle to delete objects when a need arises.
These are the errors and resolutions I found for various scenarios
Case#1: Delete a lookup table first while the table that uses this lookup is active and there are active relationships [Dependent Object Types were Entity Relationship]
Resolution: This is a very useful error. It clearly shows which tables need to be deleted first before deleting this one. I deleted the tables first so the relationships are deleted as well and then came back and deleted this table.
To test the theory, After I deleted one of the tables that uses this lookup table, I tried deleting the lookup table again and I see ‘Dependent Objects (3)’ instead of ‘Dependent Objects (4)’
I continued deleting all these dependent tables and then I was able to successfully delete the lookup table.
****************************************************
Case#2: Delete a table first while the table has an active Business Rule published for it [Dependent Object Types were Sdk Message Processing Step & Sdk Message Processing Step Image]
Interestingly this error did not have a display name and name associated at all. And the object type error does not help in deciphering that the error is because of the Business Rule. I looked at the table properties and figured there are no lookups or other dependencies involved. The only thing I have seen unique was the business rule. I tried deleting the business rule and faced another error.
Then I simply selected that business rule and clicked “Turn Off”
After turning it off, I was able to delete the business rule. Although for some reason the sequence of messages indicated on the GUI is not in the same chronological order.
After deleting this Business Rule, I was able to delete the table without any errors. It is worth noting that a single Business Rule created 5 dependencies [2 Sdk Message Processing Step & 3 Sdk Message Processing Step Image]
****************************************************
Case#3: Delete a table first while the table has an active App published on top of it [Dependent Object Types were Site Map & Model-driven App]
This error was slightly misleading because we cannot really find the sitemap as a separate object. I deleted the App, I was able to delete the table
****************************************************
Case#4: Database Time Out Error.
I simply retried the delete operation, and It worked. In cases when I was not able to delete multiple objects in a single shot and encountered this error, I deleted them one by one.
To conclude these dependency errors are of great help to build solid products, but sometimes when we really need to delete objects there should be an easier option with very restricted access and bold warning messages, and stringent approval flow. Also, some error messages in the existing framework can be improved. Hope this helps in your clean up :)