tags:

views:

28

answers:

1

I am creating a new entity in CRM 4.0 to track our projects. One field is a Project Code, and I'd like to have a way to ensure that this field contains a unique value.

I understand that this is not a key, and it won't be used as a key, but for human readability/tracking purposes, it would be nice if I could tell the user that the code he just entered has already been used.

I am thinking that a webservice/javascript call will be necessary, but I wanted to see if anyone else has tackled this issue already.

+1  A: 

Depends on how foolproof you want it to be.

  • The web service call is pretty lightweight, but if two people save a record at the same time, it's not going to detect it at that time, and dupe codes will happen.
  • A custom plugin would definitely detect dupe codes, but you don't get any feedback until after the user attempts to save. There's also still a small chance there could be repeat codes from users entering records.
  • The completely bulletproof way we've used is to have a plugin that checks a custom database table that we lock and then only let one plugin at a time through.
Matt
Thanks Matt. I'm glad to see someone else around here does CRM development, not just me. :) I'm going to go ahead and accept this answer as i don't think anyone else is going to chime in. I don't need to be super diligent about it, as creating projects is not going to have that many collisions anyway. In fact, I was being nice giving them any kind of duplicate detection at all.
Moose