Answered by:
complex primary key

Question
-
Hi there,
Is there any way to make the attrubute "name" of a given entity part of the primary key? so the user can not save entities with the same name?, or maybe anyway to make "name" to be unique?, any ideas will be apreciatted?
Cheers
Monday, April 4, 2011 3:50 PM
Answers
-
Is this CRM 2011 or 4.0?
The answer to your first question is: no, modifying the CRM database structure would render your implementation as unsupportable.
The answer to your second question is that there is duplicate detection built into CRM you can make use of.
here is a good video on setting up duplicate detection rules in CRM 4.0
http://www.youtube.com/watch?v=X8vPcV6jyLg
Here is another 4.0 example thats not a video
MSDN article for duplicate detection in 2011
http://msdn.microsoft.com/en-us/library/gg309427.aspx
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by DavidJennawayMVP, Moderator Monday, August 22, 2011 2:21 PM
Monday, April 4, 2011 4:22 PMModerator
All replies
-
You can populate name field using Java script:-
This will populate name with primary key which is always unique
crmForm.all.name.DataValue = crmForm.ObjectId;
Regards FaisalMonday, April 4, 2011 4:22 PM -
Is this CRM 2011 or 4.0?
The answer to your first question is: no, modifying the CRM database structure would render your implementation as unsupportable.
The answer to your second question is that there is duplicate detection built into CRM you can make use of.
here is a good video on setting up duplicate detection rules in CRM 4.0
http://www.youtube.com/watch?v=X8vPcV6jyLg
Here is another 4.0 example thats not a video
MSDN article for duplicate detection in 2011
http://msdn.microsoft.com/en-us/library/gg309427.aspx
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Marked as answer by DavidJennawayMVP, Moderator Monday, August 22, 2011 2:21 PM
Monday, April 4, 2011 4:22 PMModerator -
Write a plugin and register it on OnPreCreate and OnPreUpdate. The plugin will query the entity's records and throw exception if a record with the same name is found.
If this post answers your question, please click "Mark As Answer"- Proposed as answer by VishalSwamiMicrosoft employee Tuesday, April 5, 2011 6:43 AM
Tuesday, April 5, 2011 5:41 AM -
Write a plugin and register it on OnPreCreate and OnPreUpdate. The plugin will query the entity's records and throw exception if a record with the same name is found.
If this post answers your question, please click "Mark As Answer"
also make these plugins synchronus
vishal swami http://msdynamics4you.blogspot.comTuesday, April 5, 2011 6:43 AM -
Did you find the answer to this question?
Jamie Miley
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!Saturday, June 4, 2011 2:42 AMModerator