Usman Masood
Usman Masood

Reputation: 1967

Auto numbering in MS CRM

I know it's an old discussion but still an open one.

Scenario is simple you have an entity say account which contains a attribute named "AccountId" which should be auto incremented.

A prime candidate for this is Plugin registered on Pre event.

There are differnt options available to cater this.

These approaches are disccused here.

Personally I am in favour of Approach 1 but I have concerns:

1- Duplication on concurent requests

Locking and mutex can reduce that but what can be done to avoid this problem in case of "Farm environment"?

Upvotes: 1

Views: 1090

Answers (1)

ccellar
ccellar

Reputation: 10344

The problem in a 'Farm environment', which actually means multiple servers with the front-end role installed, is that your are hardly able to avoid the duplication of your counter values.

With locks or mutexes, your are only able to achieve consistency in a single machine environment.

If you need reliable numbering, you should use either a service which generates the numbers or a dedicated database (that means, not the CRM database as this would be not supported) as back-end where you could coordinate the requests with locks.

Upvotes: 3

Related Questions