Forms and Security Role Assignments

As part of customising forms in Microsoft Dynamics CRM 2011, often you would want to assign security roles to these forms.

I recently came across an issue where I got the following error when trying to publish all customisations – “Record Is Unavailable. The requested record was not found or you do not have sufficient permissions to view it.”

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: role With Id = 7ea68cb0-1c3a-4106-8bca-0895bc32e676 Does Not ExistDetail:" xmlns="">
  <ErrorDetails xmlns:d2p1="" />
  <Message>role With Id = 7ea68cb0-1c3a-4106-8bca-0895bc32e676 Does Not Exist

Turned out that it was because I removed a role that I had previously assigned to a couple of forms in an entity.

When you assign a security role to a form, the form actually references the security role by its GUID. There is no check done by the CRM when deleting a security role to check if the role is a dependant to any of the entity forms.

To identify which entities are affected and causing the problem, and if you don’t know which roles assigned to which forms, you can:

  1. open the Default Solution,
  2. try publishing the entities one by one, and
  3. take note of which ones cause the error above to appear

At this point, you can either delete the forms as the quickest way to resolve the issue, but then you have to re-create the forms. Or you can remove the dependencies by following these steps:

  1. create a temporary solution that includes the affected entities,
  2. export it as an unmanaged solution,
  3. extract and open the customizations.xml file,
  4. locate where the role IDs are being referenced,
  5. remove these references,
  6. update the customizations.xml file in the package with the updated version, and then
  7. re-import the solution

One thought on “Forms and Security Role Assignments

  1. Hi,

    I also faced same issue. I tried your solution but it didn’t work for me.

    Then I thought of deleting those forms from the entities which are carrying the references.

    And it did the magic for me. I spent almost 4 hours in this struggle but finally the managed solution is removed.

    Thanks for your solution. It gave me the direction.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s