Importing managed solution in MS Dynamic CRM Error-A record with these values already exists.

What is the Issue?

When you try to import some managed solution to the MS CRM organization, It shows the error A record with these values already exists. A duplicate record cannot be created. Select one or more unique values and try again.”  and import fails.
When you download the import Log you can find the error as below-

ImportFailError1ImportFailError2

The reason-

This happens due to manually updated the entity in target environment and you try to import the customization on that entity.
This creates the record in CustomControlDefaultConfigBase , due to which MS CRM won’t allow you to insert new entry in database.

Solution-

The solution to import these type of entity customization ,you need to delete the old database entry of your target environment by query-

select * from CustomControlDefaultConfigBase 
where PrimaryEntityTypeCode 
in (select objecttypecode from entity 
where name = Impacted Entity’)
delete from CustomControlDefaultConfigBase 
where PrimaryEntityTypeCode =Impacted Entity ID

 

Task Scheduler Error-A specified logon session does not exist

What is the Issue?

When you try to create task in task scheduler.Under Security option you unchecks the ‘Run only when user is logged on’ and select ‘do not store passwords’ checkbox on General Tab.
On create of task the error pops up saying-An error has occurred for the task TaskName. Error message: The following error was reported: A specified logon session does not exist. It may have already been terminated..
This error will not occur if the “Run only when user is logged on” Security option on the General tab is selected.

The Reason-

This error came up whether you logs on as a Local Administrator, Domain Administrator, or any other user that had rights to log on locally. When creating a new task, this error will only occur if the Security Policy –Network access: Do not allow storage of passwords and credentials for network authentication is enabled and you select the “Run whether user is logged on or not” Security option on the General tab.

Solution-

To resolve this error you need to disable security policy-
Network access: Do not allow storage of passwords and credentials for network authentication
Follow the steps-

SECPOL.MSC => Security Settings => Local Policies => Security Options=>Network access: Do not allow storage of passwords and credentials for network authentication 

taskScheduler1

Disable the policy-

taskScheduler2

Insufficient Privileges Issue-prvReadSharePointDocument Location Ms Dynamic CRM

What is the Issue?

Some time we face the issue saying -‘Insufficient Privileges’ while creating record in some entity. Let’s say example- When you try to create opportunity from lead (Qualifying Lead), for some user it shows the ‘Insufficient Privileges’ error. And if we download the log file we get following error message-

uhex

The Reason-

The error occurs because you have enabled document management to the entity Opportunity. This requires the read access to the user on SharepointDocumentLocation.

Solution-

To solve the issue give user the read access to SharepointDocumentLocation, if you are using Sharepoint or else you can disable the Document Management for the entity for which the error occurred.

In case you want to disable the setting you just need to go to –
Settings => Customizations => Customize the System => Components => Entities => Opportunity. Under the “Communication & Collaboration” section=> uncheck the box for “Document Management”.

Issue-Lookup values getting cleared on Save in Ms Dynamic CRM

What is the issue?

Your application form has some lookup fields on it and you are trying to populate the field via JavaScript. And before save the value seems to be selected/populated on form properly. But when you click on Save button the value in the lookup field disappears and become null. Even on click of Save and close the popup comes and says Unsaved changes on your form.

The Reason-

The issue with Guid that we are setting in lookups.

Solution-

You know the reason now.
Some times we get the Guid in the format-
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Convert this GUID in the format-
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

function SetLookupValue(LookupId, Type, Id, Name) {
    if (Id.indexOf('{') == -1)
        Id = '{' + Id;
    if (Id.indexOf('}') == -1)
       Id = Id + '}';
    Id = Id.toUpperCase();
    var lookupEntityReference = [];
    lookupEntityReference[0] = {};
    lookupEntityReference[0].id = Id;
    lookupEntityReference[0].entityType = Type;
    lookupEntityReference[0].name = Name;
    Xrm.Page.getAttribute(LookupId).setValue(lookupEntityReference);
}