Couldn’t import a Custom Control Default Config for ObjectTypeCode 10022 because its ‘customcontroldefaultconfigid’ already exists on the system.

Issue:

When doing Dynamic CRM OnPremise deployment, you might get above error. I am not sure of the actual root cause but there are few fixes that you can apply.

In my recent blog i have showed a fix for CustomControlDefaultConfig related error :  https://rawishblog.wordpress.com/2018/05/10/singleton-retrieve-query-should-not-return-more-than-1-record-manged-solution-import-error-onpremise/

 

Resolution:

For the above error where it talks about duplicate CustomControlDefaultConfig , you can use below method.

Use below query to find out the duplicates:

with lst as (
select CustomControlDefaultConfigId, count(*) cnt
from CustomControlDefaultConfig
group by CustomControlDefaultConfigId
having count(*) > 1
)
select ent.name, lst.CustomControlDefaultConfigId, cfg.CustomControlDefaultConfigIdUnique,   cfg.*
from lst
inner join CustomControlDefaultConfig cfg on cfg.CustomControlDefaultConfigId = lst.CustomControlDefaultConfigId
left join entity ent on ent.ObjectTypeCode = cfg.PrimaryEntityTypeCode

 

Once you have the duplicates , delete those records from this environment, export the solution again & finally try to import to other environment. Hopefully this will resolve the issue.

 

Cheers!