Nitin Dhawan CRM Discussion


Posts Tagged ‘The Given key was not present in the dictionary in Microsoft Dynamics CRM 4.0’

The Given key was not present in the dictionary.

Posted by Nitin Dhawan on December 30, 2009

In one of solution, I was facing problem with one custom entity where I was not unable to retrieve newly created attributes from a custom entity getting error [The Given key was not present in the dictionary]. However, It looks like there are few plug-ins registered on execute message for some of existing attributes. Initially, Was not sure about the logic behind these plug-ins, some where may be they are causing issue of retrieval.
To overcome this issue, I have consisder different approaches:
1.  Consisder two attributes i.e. One is old attribute & second is new which i recently created. I have written a business logic using TargetRetrieveDynamic and simple query expression. I was not getting the updated resultset but field was there in the WSDL.
2.  I have written querexpression and exposed Conditional Expressions, Filter Expressions and pass the new created attribute. I am able to get the field now in a resultset.
But, This is a not a right approach. After going some deep dive later i found it’s not a problem with the code. When ever we create a new attributes in a exiting published custom attributes having records. We need to explicitly manually anter one value in a database table. Value can be 0 but should not be null.
After inserting one entry in table my code start working. Happy Coding 🙂

Posted in CRM [Archive] | Tagged: , | Leave a Comment »