Auto generated numbering in CRM capability
Suppose I add one field called Acc Code to Account. In this field, the user can manually enter 2 digits of the alphabets. Example: The user will create an account named "Successful Company Pty Ltd" and the user manually enters the Acc code with "SC". the user will create another account named "Other Company Pty Ltd" and the user enters the Acc code with "AC".
In the Opportunity field, I add one field called Opp Code. This field contains 5 digits, 2 alphabetical digits of the verification code from the prospect (the account referenced by "Opportunity as a customer"), and 3 digits are autoruns. Autonomy depends on the potential client. This means that for a potential customer "Succesful Company Pty Ltd" the Opp code is SC001, if there is a new opportunity for him again, the code is SC002. If a "Opportunity" "Other Company Pty Ltd" is created for a prospect then the initial Opp code is AC001.
I need a suggestion on how to implement automatic numbering depends on the prospect. I assumed to be using Plug-in, but not sure how to find the last Opp code number (since the number depends on the Acc Code). Can anyone help or give an example on how to do this?
Thanks:)
a source to share
This is using pseudocode.
- You can search to get all the "Opp Code" starting with "Access Code".
- Then you parse those "Opp Code" (you know this is AA000, so you remove those first two letters) and take the maximum number and then add 1.
- Then you will install a new "Opp Code" for your option.
Good luck.
a source to share
Plugin-plugin seems to be the best approach. I'll start by sketching my process on a whiteboard or piece of paper. You should be very clear when this will happen. Then you can start writing the plugin because you know what's going to happen where.
I'm sure you have found many resources on how to write Crm plugins. The hardest part of developing for Crm is the hardest task for any type of development, you have to decide how you are going to do it. For instance:
- Can I create / modify an Outlook client capability?
- What happens if I use a contact instead of an account?
- Will he take on the parent's account of the contact?
- Can I change my account if possible after creating it?
Once you have a very clear idea of what you want to do, I am sure that most of the help can help you when you run into certain problems.
Based on all these questions, there will be an answer on how best to approach this problem. Perhaps the client is expecting very little of this, and you need to come up with a solution that is perhaps not very robust, but develops faster than the full plugin.
a source to share
This is how I would do:
- create an additional field in the Account object that will be able to meet opportunities.
- when creating a new account, set this field to 1, as this will be the next number assigned to the opportunity with this account as a prospect.
- When a new opportunity is created, find the next number in the account field.
- assign this number opp code opportunity
- increase the account number.
Steps 3 - 5 should be in the plugin. It is important that they are performed as an atomic operation and only one at a time. Use the Mutex class to ensure that since crm plugins run across multiple processes. (unless you have a farm deployment. In that case, the mutex won't work.)
a source to share