3/31/11

Using CrmMoney in CRM 4.0 is Evil

When you need to use CrmMoney Class in CRM 4.0 I recommend that to use simple int instead.
Everything works fine until from some reason you need to change this field, When I deleted this field and created a new one with the same name but with other type, I get an error message "Microsoft.Crm.ObjectModel.MultiCurrencyPlugin Error".

I tried a lot of solutions that I found over the web but none of them helps me, So I deleted the entity and the connections, Create a new one and all works right.

So the conclusion is if you not must  use CrmMoney NOT use it!!!

3/7/11

CRM 2011 First Steps - AutoNumber

Last week someone asked me if the CRM 2011 already contains a support for AutoNumber.

Background:
AutoNumber is the basic method to give unique number to a record in DB, when a record saved in DB we can add to a record a unique number usually the new number will be bigger from the previous, in SQL this operation called auto increment and automatically done by the DB.

After a quick scanning the new SDK I found that in CRM 2011 there is no out of the box support for the autonumber just like in CRM 4.0, however CRM 2011 supports autonumber just for a few entities as the picture display.

So the solution is the same just like in CRM 4.0, create a plugin register it on 'pre' operation for all entities, create a new custom entity, you can call it 'autonumber' and save there the max last number, every time when a plugin executes add one number and save it.