When it comes to creating a custom Entity in Dynamics CRM, the possibilities are quite possibly endless. One of the reasons for writing this blog comes from an initial setting that is mandatory for all customer Entities – Ownership. As shown below there are only 2 settings to choose from, Organization or User or Team, both have valid uses depending on the Entities purpose or how flat the organization security model is…the choice is yours.

clip_image001[4]

So you pick Organization for Ownership, a good choice when you have initially spec’d out the Entity with the Client – However what happens if you find that the security model demands User or Team level security? If you’re still in Dev, you could opt to just rebuild the Entity, if you have already gone live as I had done before writing this blog, you will find the below very useful.

Changing Entity Ownership from Organization to User or Team Owned – Methodology

This method is suited better for multi-environment deployments of CRM (i.e. Dev, UAT, Live).

  • You will need to create a solution containing your Entity that requires modifying ( I would include components as it makes for a much smoother import process)
  • Export your solution and store in a safe place
  • Export the same solution again
  • Find your solution and unpack the file using WinZip or something similar
  • Copy the Customization XML to the desktop 
  • Open the File with either Visual Studio or you can even use Notepad 
  • Follow the 3 steps below to edit the XML

XML Change #1

Change the OwnershipTypeMask tag from ‘OrgOwned’ to ‘UserOwned’

clip_image002[4]

* Tip – use Ctrl + F to find the correct location easily

XML Change #2

Remove the ‘OrganizationId’ field from the XML for the offending Entity.

clip_image003[4]

XML Change #3

Remove the Relationship linking the Entity to the Organization – stripping out the EntityRelationship tag entirely:

clip_image004[4]

That’s it – CRM 2015 is then clever enough to see the Entity is now User or Team Owned and create the required OwnerId and OwnerIdName fields in the background during the XML Import.

  • Save the file and then add the Customization XML back into the Solution zip file
  • Your target CRM environment will need to have this entity removed before we Import.
  • This is for all environments not just for the initial re-import
  • Back up any data for the entity you wish to keep
  • It’s always best practice to have a rollback point – so back up any Entity and Components before deleting
  • If you have a test environment, deploy the modified Solution there, Import the data back up and test – Does changing the Entity Ownership give you the results you were looking for?
  • Once happy repeat the Entity deletion in the Live CRM environment and import the newly modified version of Entity from the Dev/UAT environment, Import the data and test.

Following these steps should turn a potential headache into an easy success – whether it’s during a new CRM system build or part of on-going CRM system support.

Author

Write A Comment