Auto numbering features are important in any business application to accomplish some business needs. Same in the CRM application and it needs additional customizations and plugin(or a custom workflow) to be implemented for the entity to statisfy auto numbering requirements. Jaimie Ji has a solution for this in CodePlex and this post is to demonstrate how to get use of Auto Numbering Solution in CRM. Advantage of the solution is that; developers dont need to write seperate plugins for each entity which needs auto numbering and it provides prefix, postfix, starting number and increment by features as well. Also it always open to change the configurations and no need any hard code values.
Unmanaged Solution (http://crm2011autonumber.codeplex.com/)
Auto Numbering Solution has a CRM solution and the solution contains one entity called “Counter” to save all the settings for all the counters. If there are two auto numbers in two different entities, just need only two records of this counter entity in the CRM application.
CRM.Plugin.SequenceGenerator is another component of the solution. If the solution doesnt contain the plugin, developers can get the source code from CodePlex, build it and can get the assembly registered in the CRM application manually.
There are some images as utilities to the Counter entity in the solution.
Source code contains the visual studio solution for the plugin. Developers can download the code, buil it and use the assembly for the registration. Plugin registration tool can be used to register the pluging in CRM application. The assembly can be attached to the CRM auto numbering solution and can be exported as a managed solution to be used in some other CRM projects.
Requirement is to generate auto numbers for Students and Courses in an Institute. Student Numbers has a prefix which can be a current year. Courses has a postfix which related to the type of the course.
Create a seperate solution for the application (AutoNumberingTesting solution has been created) and create Student and Course Entities.
Student Entity: Auto numbering field is “Student Number” and it is a TextField. This should not be a WholeNumber field as the Numbers can have prefixes and post fixes with it.
Course Entity : Auto numbering field is “Course Number” and it is also a TextField. This should not be a WholeNumber field as the Numbers can have prefixes and post fixes with it.
Publish the AutoNumberingTest soution.
Import the Auto Numbering Solution to the CRM application and publish it.
If the CRM.Plugin.SequenceGenerator is not included in the CRM solution just get the source code (http://crm2011autonumber.codeplex.com/SourceControl/list/changesets), build it and register the plugin using plugin registration tool.
Register two steps as it needs to be triggered at Student and Course entity creations.
Student Entity Creation Step
Course Entity Creation Step
Then enter counters for Students and Courses with the following values as follows; Student numbers will be starting from 101 and course numbers from 11 according to the counter settings.
Application is ready to be used and create some student records and course records.
The solution has worked nicely and it reduced the time of writing new plugins for the CRM application. 🙂
Thanks to Jaimie Ji http://crm2011autonumber.codeplex.com/