Generating a number automatically within CRM is one of those requirement which is been asked , almost by all client/project. We all know that auto-numbering is available out of the box for entities like case, contracts, quote, order, invoice, articles & campaigns. But usually we have two situations:
- Auto-numbering for entities like account, contact, opportunity etc. (not available in out of the box auto-numbering feature)
- Condition wise auto-numbering (business unit wise, category wise)
I am going to demonstrate situation 2, which will give you an idea for situation 1 too.
What you would need ?
- A custom entity
- A Real-time workflow
I am taking an example where I want my accounts should populate ‘account number’ based on ‘account category’. I have also created a lookup field on my account called ‘auto-counter’ which you can see just below category.I have got three categories in my account:
- Direct (DC)
- Distributor (DB)
- Secondary (SC)
What I want ?
I want an account number to be generated having prefix of category and then sequential 6 digit number like if my account category is direct and i am creating the very first account in CRM then account number must be like DC100001.In your case it can even be like prefix should be Business Unit’s initial; method remains same.
How to go about it?
Create a custom entity with basic field Name and other fields to be created would be equal to no. of conditions you have for auto-numbering; in my case i have 3 conditions that are account category. You might have a situation wherein you want it based on Business unit so, you will have to create fields equivalent to the no. of business units you have.
Go to settings>>Customization>>Customize the system
Click on new to create a new entity
You will now have to create records equal to the no. of conditions you have; so i have 3 categories in account which means 3 conditions and 3 records:
I have kept the name as DC/DB/SC, based on the prefix i want for my account number and in the fields based on my condition i have filled DC, DB & SC as 100000 (since i wanted a 6 digit no.); Please note that, you will have to create separate records for each condition. In the first record I have created, I have filled name as DC and field ‘DC’ (whole number) as 100000. Similarly, In the second record I have created, I have filled name as DB and field ‘DB’ (whole number) as 100000 and so In the third record I have created, I have filled name as SC and field ‘SC’ (whole number) as 100000
Now we can create a real time workflow on accounts:
Now we can add steps to this workflow along with if and updates:
First of all I am checking the category of my account; Secondly, I am updating auto-counter lookup field on account with relevant record of category:
Then I am updating my auto-counter record (increment by 1)
Then I am updating my account number of account with a combination of name-number of my auto-counter relevant record:
Now if i create an account, account number is generated as soon as i save my record; something like below:
- Please do hide, auto-counter field on form once your workflow starts working.
- To remove the comma from the Auto-Number field (whole number), copy it to a calculated field of Single Line of Text
Hope you find it helpful !
Thanks for Reading !
Happy CRMing !!
5 thoughts on “Auto-Numbering through Real Time workflows (No customization, No Add-on)”
Hi – I’m trying to do scenario 1 for opportunities in CRM 2015 but running into issues, would you happen to have instructions for the non- condition based auto numbering?
The Auto Count Entity is not Show in my Crm during workflow what can i do..plz help
Have you created a relationship between Accounts and Auto Number entity?
It works fine for Create Trigger but behaves strangely for Update of field (Category) trigger in same workflow.
Ex. If we had the selected Category as DC 1st on Create it updated the Account Number to DC100001.
Then suppose the user realizes that he selected wrong Category and now updated the Category to SC the Account Number is updated as DC1.
Then on same record if i change Category to DB, auto number goes to SC1.
Strange that it picks the previous Category Name but increments the new Category.
Also, instead of 100001 it increments single digits as 1, 2, 3, etc.
Appreciate any explanation to it, so that we may think of some way out of this for the Field update trigger.