Replacing Built-in Entities / Offline Client
Last week I ran into a bug with the offline client when you rename and replace one of the built-in entities with your own custom one.
To keep this simple, imagine if you wanted to replace the built-in Order entity with your own custom Order entity (new_order). If you try to create a custom entity and give it a display name of an existing entity you will get an error and it won't let you save it. Why you ask, isn't the custom entity prefixed with your own schema name so this wont happen? Yes, but CRM also wants to make sure the Display Names are unique.
So to get this to work, you must first rename the existing Order entity - let's call it "Built-In Order" and then you MUST publish that entity. If you don't publish, it still will give you an error creating the new entity.
Once the old entity is renamed and published, you can now create your new Order entity which will really have a schema name of new_order or whatever your prefix is. Publish it and all will work well from the web client.
Where the fun starts is if you have any offline users that had synchronized and gone offline with the original built-in Order entity before we renamed it. If you do they will fail with an error "An Entity with the specified name already exists" when they try to go offline after you publish your new entity.
The reason for this is simple, there's a bug in update of the metadata on the client - I have opened a support ticket to request a fix. The complex thing is how to get out of this situation. As best I can tell there's no 100% supported way to do it, the problem is the local database table LocalizedLabel has rows with the old name. Once those rows are updated, the client will update the metadata ok, and allow the client offline - Remember this is a local database issue so each offline client that had the issue would need to be fixed.
To avoid this till fixed about all you can do is if you need to rename a built-in entity like this, make sure to rename it and try to force all offline users to go offline once before you create the new entity.

Reader Comments (1)
Cause I've the same problem.
Markus Schmidt
(from Germany)