In MS CRM 4.0, is there a way to ensure that a field is unique?
I am creating a new entity in CRM 4.0 to track our projects. O开发者_如何学编程ne 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.
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.
精彩评论