nairware
nairware

Reputation: 3190

Import Failure - Role With Id Does Not Exist

I am getting an import error in a specific environment with a managed CRM 2011 solution. The solution has been imported before into many other environments, but the one in particular where it is failing is throwing the following error:

Dependency Calculation
role With Id = 9e2d2d9b-645f-409f-b31d-3a9c39fcc340 Does Not Exist

I am a bit confused about this. I searched within the solution XML and was not able to find any reference to this particular GUID of 9e2d2d9b-645f-409f-b31d-3a9c39fcc340. I cannot really find it in SQL either, just wandering through the different tables, but perhaps I do not know exactly where to look there.

I have tried importing the solution multiple times. As a desperation effort, I tried renaming all of the security roles in the destination environment prior to importing, but this did not help.

  1. Where is this reference to a security role actually stored? Is this something that is supposed to be within my solution--which my existing CRM deployment is expecting me to import?
  2. How do I fix the problem so that I am able to import this solution?

Upvotes: 3

Views: 2369

Answers (2)

denious
denious

Reputation: 173

Perfect solution, worked for me! My only comment would be the error in Script B: it shouldn't clear the template IDs of all roles for the given template, only the template ID of the newly created "fix" role, as follows:

update RoleBase
set RoleTemplateId = NULL
where RoleID='WXYZ74FA-7EA3-452B-ACDD-A491E6821234'

I would've gladly put this in a comment to the answer, but not enough rep as of now.

Upvotes: 1

nairware
nairware

Reputation: 3190

This is the code we used to fix the issue. We had to run two different scripts. Script A we had to run a total of four times. Run it once, attempt the import, and then consult the log to find the role that is causing the problem--if you receive another error for another role.

To run script A, you must use a valid RoleTemplateId from your database. We just picked a random one. It should not matter precisely which one you use, because you will erase that data element with script B.

After all of the roles are fixed, we got a different error (complaining something about the RoleTemplateId was already related to a role), and had to run script B. That removes the RoleTemplateId from multiple different roles and sets it to NULL.

Script A:

insert into RoleBaseIds(RoleId)
values ('WXYZ74FA-7EA3-452B-ACDD-A491E6821234')

insert into RoleBase(RoleId
    ,RoleTemplateId
    ,OrganizationId
    ,Name
    ,BusinessUnitId
    ,CreatedOn
    ,ModifiedOn
    ,CreatedBy
    )
values ('WXYZ74FA-7EA3-452B-ACDD-A491E6821234'
    ,'ABCD89FF-7C35-4D69-9900-999C3F605678'
    ,(select organizationid from Organization)
    ,'ROLE IMPORT FIX'
    ,(select BusinessUnitID from BusinessUnit where ParentBusinessUnitId is null)
    ,GETDATE()
    ,GETDATE()
    ,null       
    )

Script B:

update RoleBase
set RoleTemplateId = NULL
where RoleTemplateID='ABCD89FF-7C35-4D69-9900-999C3F605678'

Upvotes: 5

Related Questions