Sunday, February 6, 2011

When Saving an Account Record You get a Type Cast Error

There are times that after a data migration to CRM accounts table and you try to do a change to the account record and save it you get an error. Mostly you get specified cast is not valid exception.

If you try to save another record you might not get this error. This gets you thinking. What have I included in the error record and not in the corrected saved account record? 

Put the dialog trace that is given by CRM and enable the trace. You will not get a detail view of the error, but an important thing you will see. Right before the exception there has been method fired to update the address.

This is the place to start working with this. You should know when you save an account record there will 2 another entity that will get updated, which is customer address base entity. For each account record there will be 2 address records in the customer address base. However you will be displayed in the associated view only one record. If you don’t have these records and if you try to save the accounts record you will get an error.

This will most probably occur with migrated data as we will not migrate records for customer address base if there are not addresses. However you at least will have to add some dummy records to get his working. By doing that you will be able to save the accounts records.

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...