Showing posts with label Error and /issues. Show all posts
Showing posts with label Error and /issues. Show all posts

Monday, 8 January 2018

Unable to connect Plugin registration tool to Latest Dynamics 365 Version 9.0

Unable to connect plugin registration tool 

Recently i created a trial D365 org (version 9.0.0.3172) and tried connecting plugin registration tool downloaded with PRT of lastes sdk (version 8.2.1.1)from downloaded form here which is latest as on date on that portal of MS.

Newly created trail org is of version 9.0. while the latest sdk available is 8.2 but i though it shouldn't be any problem (though it was) since we were used to of using older version plugin registration tools with newer version of CRM ( remember connecting CRM 2013 organisation with PRT of 2011 sdk).


On some digging i found that reason of the same:

Latest Update on Dynamics CRM V9:


Latest update in the Microsoft TSL(Transport Security Layer) Protocol in SDK assemblies.

Microsoft allowed the TSL connection 1.0  and 1.1 for the browsers or client to connect the CRM org. Now Microsoft will support only TSL 1.2 or above. Can get more information here

If you are connecting your latest dynamic CRM trial org with the old version of plugin registration tool or connecting any external application, then you may face an issue.


TSL protocol of our .Net client is usually 1.0. You can check how to check tsl protocol of your .Net client by downloading fiddler from here

Once Fiddler gets installed, Go to Tools > Options in order to check Protocol version:



To Resolve Plugin registration connection issue we need to install Latest Plugin registration tool from Nuget rather than using PRT(Plugin registration tool) available in latest sdk available on MS website which is version 8.2.1.1 :-

Resolution:

There are 2 way of installing Latest Plugin registration tool easily:-
Option A:-

1. Create/Open a project in Visual studio



2.  Navigate to Tools>NuGet Package Manager>Package manager console


3. Paste following command in Packager manager console and hit enter:
Install-Package Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -Version 9.0.0.7


once executes, this will install the package in current opened solution folder.

4. Open the folder of the solution opened in Visual studio:


5. You'll see PRT V 9.0 in package folder:


6. Now try to connect to your version 9.0 CRM trial, it'll get connected. :)


Option B:-


1. Create a new project just like step 1 of Option A.

2. Right click on the project and click manage NuGet Packages:


3. Click on browse and enter 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool'  and click install:-


4. It'll install the package in your solution's folder:-


5. You can navigate to the installed package same as step 4 and 5 of option A mentioned above.

6. Now connect your PRT with version 9.0 crm org and enjoy plugin registration.

Happy CRM,

Tuesday, 16 August 2016

MS CRM Error: The Entity Relationship with SchemaName = '" was not found in the MetadataCache

MS CRM Error: The Entity Relationship with SchemaName = '" was not found in the MetadataCache


Recently i was having this issue while opening any existing account record or creating a new account record in a CRM org.
Error message: The Entity Relationship with SchemaName = '" was not found in the MetadataCache

Log file
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #D985AF1CDetail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147220970</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #D985AF1C</Message>
  <Timestamp>2016-08-16T06:57:30.9208191Z</Timestamp>
  <InnerFault>
    <ErrorCode>-2147220918</ErrorCode>
    <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>The Entity Relationship with SchemaName = 'new_account_new_orderproduct_CustomerName' was not found in the MetadataCache</Message>
    <Timestamp>2016-08-16T06:57:30.9208191Z</Timestamp>
    <InnerFault i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <TraceText i:nil="true" />
</OrganizationServiceFault>

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Now what i had done is that on a custom entity order product, i had created a lookup of account entity. (Oh please don't ask why we created custom entity named order product..!)

Also on account record, i have attached a grid of all order products (custom entity) using that lookup of account i created on custom order product entity.

Now the issue start occurring when i deleted the lookup of customer entity from custom order product entity.

I forget that relationship formed from this lookup has been used in that grid on account form.

Now whenever i tried to open main crm form (existing account or a new one) system throw the above error.

It'll off-course throw this error because metadata on account form have the reference to such a relationship which doesn't exist any more..!

So to fix this what i did is, i removed the grid of custom order product entity from account entity which was referring a relationship which doesn't exist anymore.

So the thing we learn from this is that whenever we are deleting a lookup we should keep in mind that we are also deleting the relationship associated with it.

And if that relationship is used anywhere else, for this case in a grid, system will always create an issue.


Hope it would be helpful.
Feel free to comment and improve.

Sunday, 14 August 2016

MS CRM error: 1 is not a valid status code for state code SalesOrderState

1 is not a valid status code for state code SalesOrderState.Submitted on salesorder with Id <Guid>


Error Code -2147187704

Today i face the error on while creation of sales order in Dynamics CRM online 2016. System wasn't letting the user create sales order and throwing a generic exception with message :

1 is not a valid status code for state code SalesOrderState.Submitted on salesorder with Id <Guid>

with error code: -2147187704.

This was pretty unusual because i know that 1 is a valid status code code for sales order.

After much research, the solution i found was then relatively easy. For the user the indicator "Integration Users Mode" in the user administration was switched to Yes. 

But the problem was this flag isn't usually displayed on the CRM user form.
So here i used little trick. I created a on demand workflow to set back the field to NO and run the on demand workflow on the user.  

After I put this flag back to No everything was working as per the expectations.

My observation is that recently the user had experimented with the CRM connectors to connect the CRMs with Navision, while the flag was changed by the Connector.


Hope it would be helpful.
Please comment if any better solution exist.