Auto Number generation using Real Time Workflow in MS CRM 2013
Hi All,
I am going to show you the example of Real Time Workflow for Auto Number generation.Follow the below steps to create Auto Number for Contact entity,
Step 1: Create a Custom Entity “Counter” with the following Fields
Counter Value: Whole Number (Range as required)
Step 2: Create One Record in Counter entity as follows,
Step 3: Create N:1 relationship between Contact to Counter entity as follows,
Step 4: Create “Contact ID” field in Contact entity as follows,
Step 5: Place “Contact ID” and “Counter_Contact” fields on the Contact entity form and hide them,
Step 6: Create a Real time workflow as follows,
Step 7: Create a step to Update “Counter-Contact” record in Contact entity as follows,
Step 8: Update Counter Value from Counter entity as follows,
Step 9: Update Counter Value by 1 in Counter entity
Step 10: Activate the Process and Create Contact Record
Please provide your valuable comments.
Discover more from Arun Potti's Power Platform blog
Subscribe to get the latest posts to your email.
Excellent!! No need of plugins from now…
Very nice information
Nice information!!! But what if I need to work with Outlook Offline Client? Greetings!!!
I am in fact thankful to the holder of this site who has shared this enormous article at here.
Great Article! I’ve been thinking about doing this for a customer who wants to generate a “record id” for Accounts. However, they want their number to start with 320001. In CRM, whole numbers appear as 320,001. I don’t want that comma in my record id. Any thoughts on that?
Thanks Jeff.
In JavaScript onload, you can write code to replace comma with empty string. Will blog that in my next post.
Hi Arun – Actually, I tested this a bit more and no need for a jscript! In my CRM Admin User Preference, I can change my Number formatting to NOT have commas. Then, I just have the workflow run in context of the owner of the workflow (the CRM Admin). When I update the Customer ID text field, there is no comma! So we are good to go! Thanks again for the article!
Its good jeff.
But if you change Number formatting, it will effect Money related fields will appear without comma.
Check once.
That is a good point, it does indeed change the format of currency fields too. However, in this case it is ok. It is a personal setting that I changed just for a CRM User we have that is for administration only. So in this case, I don’t care how those currency fields appear to this seldom used CRM User.
I used to be able to find good info from your blog articles.
I do not even know how I ended up right here, however I believed this put
up was once good. I do not realize who you are but definitely you are going
to a well-known blogger when you are not already.
Cheers!
Thank you Marie.
That is really fascinating, You are an overly skilled blogger.
I have joined your feed and look ahead to seeking extra of your fantastic post.
Also, I’ve shared your web site in my social networks
Thanks Jenifer.
Thank you jenifer 🙂
Hello there, just became aware of your blog through Google, and found that it’s truly informative.
I’m going to watch out for brussels. I will appreciate if you continue this in future.
Many people will be benefited from your writing.
Cheers!
Thank you
Nice simple Idea so simple then again the best ideas usually are.
Have you tested this with imports or multiple users adding records at the same time?
Thanks
John
Prefty nice post. I just stumbled upon your weblog
and wanted to say that I have really enjoyed surfing around your blog posts.
After all I’ll bee subscribing to your rss feed and I hope you write again soon!
Thank you Charlene
Hello Arun,
you did a great job, however it failed when i’m doing migration of data all at one go. I tried to make it on-demand workflow and run it. I duplicated the id’s. I only works when you create one by one.
Thanks,
Drew
Very couple of web-sites that occur to be in depth below, from our point of view are undoubtedly effectively worth checking out.
Thanks for the information 🙂
Can you please help me on this: filtration of options on the basis of value selected.
like if i have to select between ice cream & soft drinks, if i have selected ice-cream then i only related options will be visible.
Will share in the next article
Hi Isha,
Follow the below article,
https://arunpotti.wordpress.com/2015/05/14/filter-optionsets-based-on-selection-in-ms-crm-using-javascript/#respond
Provide your valuable feedback on this article.
Excellent! No need to write Plug-In
Gr8 Arun u r rocking…
Thank you Manohar
Hi Arun,
Thanks for your solution
Just a question: how can I be sure that when two person are creating a contact at the same time there will be two different ID?
Sylvain
Hi Sylvain,
We can be sure of it because all the steps in this synchronous workflow will happen in single database transaction. So it won’t allow same ID counter to be updated to 2 records at any time.
Thanks,
Saikrishna
Wow cuz this is great work! Congrats and keep it up.|
Great site. Lots of helpful info here. I am sending it to a few friends ans also sharing in delicious. And of course, thanks for your effort!
Thank You 🙂
hello again. this is really true
hello again. this is really true
Hi Arun,
This blog is very helpful and useful to CRM Developers.
Thank you Arun 🙂
Hi Arun,
I am using 2016 trial account. I followed the exact way you have mentioned above to generate an auto-number. But I am not getting it. Could you help please.
Hi Anju,
Process is common for Custom or System Entity.
Please recheck all the steps and try again.
Hey, awesome webpage you have got right now
Thank you 🙂
Hello there, great site you’ve got right now
Thank you 🙂
Great web websitewebsite! It looks very professional! Maintain the good job!
Thank you 🙂
You have got superb thing listed here
Thank you 🙂
Wow, incredible blpg layout! Ꮋow lоng have you beеn blogging fοr?
үоu maҝᥱ blogging look easy. TҺe overɑll ⅼooк of your sie iis magnificent, as well
ass thе content!
Thank you Gus 🙂
Much thanks! This a wonderful web-site!.
Hi, Is it possible to add a generic prefix to the number? I.e I need the same three letters to appear before the auto generated numbers?
Hi Ashleigh,
Add required prefix, before Contact Id as mentioned in Step 8.
its’ working bro thanks for providing good article for Auto Numbering
Thank You 🙂
Arun great article to bring to the masses. How do you deal with duplication of auto numbers when two users save at the same time? I had thought that workflows would not run up against one another when dealing with the same entity (such as locking in C# code) but this is not the case.
Hi Jonathon,
There is no issue with duplicate numbers with this approach. As we are using real time workflows, CRM will lock the table until it process the next one. So, to test this scenario try to import some records using Data Import Wizard and see for any Duplicate numbers.
Thank You.
Hi Arun,
I did test with user interaction, meaning two users clicking save at the same time. This resulted in duplicate numbers. The exclusive locking did not appear to happen when running the Synchronous workflow.
Bestest Solution..:-) Thanks its very helpful