Answered by:
Creating a unique attribute in CRM Entity

Question
-
hi,
I'm creating a new attribute in a CRM entity (Contact or Account), i need the new created attribute to be Unique on the level of the entity.
If any user would add a new contact with the name info in the new created field, an error message should appear.
On the other hand i need also to create an autogenerated field depending on a certain formula.
Can anyone please advice how to to this ??
Thanks for your supportTuesday, March 9, 2010 2:31 PM
Answers
-
There are two option for the duplicate check.
1. Create a Pre Stage plugin that checks for this constraint and throw an InvalidPluginExecutionException to alert the user and prevent the recor dbing saved.
2. Create a Duplicate Rule for this attribute, problem being that the user will be presented with a dialof warning them of this but they can still choose to save.
The auto generated number can be performed a number of ways,
http://www.codeplex.com/crmnumbering/
http://blogs.msdn.com/crm/archive/2008/05/13/auto-numbers-in-microsoft-dynamics-crm.aspx
http://crmintherealworld.blogspot.com/2008/12/using-workflow-to-generate-auto-numbers.html
http://mahadeomatre.blogspot.com/2009/07/auto-generated-account-number-using.html
I prefer to use a plugin with a custom configuration entity and I write my own plugins so I have not utilised any of the above although the crmnumbering link is the closest.
MSCRM Bing'd - http://bingsoft.wordpress.com- Marked as answer by GKSPLB Wednesday, March 10, 2010 8:09 AM
Tuesday, March 9, 2010 2:53 PMModerator -
HiAs Clinton suggested, you can create and use plugin (Pre Stage pluigin) to prevent duplicate detection.You can restrict the user from saving the record using InvalidPluginExecutionExceptionReferRegardsVinoth
- Marked as answer by GKSPLB Wednesday, March 10, 2010 8:09 AM
Tuesday, March 9, 2010 4:04 PM
All replies
-
There are two option for the duplicate check.
1. Create a Pre Stage plugin that checks for this constraint and throw an InvalidPluginExecutionException to alert the user and prevent the recor dbing saved.
2. Create a Duplicate Rule for this attribute, problem being that the user will be presented with a dialof warning them of this but they can still choose to save.
The auto generated number can be performed a number of ways,
http://www.codeplex.com/crmnumbering/
http://blogs.msdn.com/crm/archive/2008/05/13/auto-numbers-in-microsoft-dynamics-crm.aspx
http://crmintherealworld.blogspot.com/2008/12/using-workflow-to-generate-auto-numbers.html
http://mahadeomatre.blogspot.com/2009/07/auto-generated-account-number-using.html
I prefer to use a plugin with a custom configuration entity and I write my own plugins so I have not utilised any of the above although the crmnumbering link is the closest.
MSCRM Bing'd - http://bingsoft.wordpress.com- Marked as answer by GKSPLB Wednesday, March 10, 2010 8:09 AM
Tuesday, March 9, 2010 2:53 PMModerator -
Hi,
Thanks for your reply,
I have a concern regarding the Duplicate detection, when i applied it through a Duplicate detection rule, the rule generates a warning message although the user still can save the record even with the duplication , is there anyway to forbid the user of saving the record as long as the duplication exists?
thanksTuesday, March 9, 2010 3:51 PM -
HiAs Clinton suggested, you can create and use plugin (Pre Stage pluigin) to prevent duplicate detection.You can restrict the user from saving the record using InvalidPluginExecutionExceptionReferRegardsVinoth
- Marked as answer by GKSPLB Wednesday, March 10, 2010 8:09 AM
Tuesday, March 9, 2010 4:04 PM