Jim
Jim

Reputation: 6881

Change entity schema name without deleting and recreating

I'm working with a vendor developing a new project on Microsoft Dynamics 365 CRM, with quite a bit of custom functionality and custom entities. The vendor has made some assumptions about entity names that I don't agree with, and I'd like to change the entity names. I've been told that they can change the display name, but can't change the actual entity schema name without deleting an recreating it, and that would be a significant amount of effort because they'd need to then reconfigure all the relationships and business rules around those entities.

I'm not saying they're wrong, but it kind of blows my mind that Microsoft wouldn't have any way of refactoring entity names. This isn't a live application - it's in a fairly early stage of development. I'm wondering, is there any way that we can change entity names without deleting and recreating them?

One thought I had was perhaps exporting the solution and manually editing that exported solution; I believe when you export a solution it outputs a zip file that then could be imported to a separate environment - could that zip file be manually modified to change entity schema names, then imported? I don't care if that means we'd be annihilating data.

Upvotes: 5

Views: 10616

Answers (4)

avolkmann
avolkmann

Reputation: 3105

Yes it is possible to change the logical name of an entity without deleting and re-creating all metadata from the UI.

However, you will likely need to start from a fresh env or reset your existing one, because a lot of metadata is cached in the instance and will cause conflicts when importing. For example, SDK step GUIDs will conflict even after deletion.

The general process to rename an entity looks something like this:

  1. Replace logical name
  2. Replace logical id name
  3. Replace physical id name
  4. Replace set name
  5. Replace state and status code names
  6. Update relationships
  7. Rename files

Any tool with advanced find & replace functionality will do, but I personally recommend IntelliJ Idea, because it indexes your solution initially, making all subsequent operations nearly instant.

Upvotes: 1

Todd Shelton
Todd Shelton

Reputation: 86

The XRM Toolbox Attribute Manager (by Daryl LaBar) is a pretty handy tool for "renaming" most Dynamics CRM/Dataverse attributes (except complex attributes like option sets). "Renaming" here means:

  1. Create a new attribute using the old name and schema;
  2. Copy the data from the old attribute to the new attribute;
  3. Delete the old attribute.

There are more steps than that and you have good control over which steps you may choose to not use. Attribute Manager's real strength is that it moves data, allowing you to change entity names on production systems--if you dare...

Daryl has written a concise, easy to use tool. With that said be sure to set up some tests so you can get familiar with how it works.

Upvotes: 1

James Wood
James Wood

Reputation: 17562

Your vendor is correct this isn’t possible. Schema names are locked on creation, due to the number of dependencies that are generated as the system is customised.

Whilst you could attempt a manual edit of the solution file its not supported.

Editing a solutions file to edit any solution components other than ribbons, forms, SiteMap, or saved queries is not supported.

So even if you get it work, it will probably be a bit a pain, and you run the risk that you generate problems for yourself further down the line. The customisations directly affects a large number of elements, including the database, and it’s pretty difficult to predict the exact consequences as so much functionality is wrapped up implementations we have no control over. If you do run into those problems Microsoft may be less than helpful as you would be unsupported.

Speaking from experience, whilst it’s irritating this is one of those things that is best to just leave be and move on. End users will have no idea schema names even exist, it’s only visible to technical people. Entity display names change regularly, so it’s not unusual to find a schema name different from a display name - the out of the box entities come that way, i.e, incident, kbarticle, transactioncurrency, importmap, template, list, salesorder, bulkoperation to name a few. Account always seems to be renamed to organisation or company. The benefit of changing schema names is so small for the effort and risk involved, if it was me I would spend my time and effort elsewhere.

Upvotes: 8

Jason Lattimer
Jason Lattimer

Reputation: 2848

Since it's early on you're better off deleting and recreating. Hacking the solution XML isn't going to change the table or field names in the database. Sure you could maybe get away with exporting, editing, and re-importing into a different environment but re-exporting and importing back into the original environment isn't going to fix it.

Upvotes: 8

Related Questions