Today’s tip is from Shidin ‘D365fanboi’ Haridas – thank you!
Got a tip of your own? Why won’t you send it to firstname.lastname@example.org when you have a minute? Now, over to Shidin.
Most CRM implementations, at some point, would have required to implement a bespoke auto-numbering system.
However, testing the custom built auto-numbering solution end-scenarios, especially involving optimistic concurrency was always the toughest challenge.
Flow can be used to help out testing such end-scenarios of optimistic concurrency:
- Create a flow with a loop to create the entity records (in the below example, initialized an array collection to loop through)
- In the loop control settings, enable ‘Concurrency Control’ and increase degree of parallelism to 2+.
- Now, when the flow executes, multiple records will be created in the Dynamics 365 database at the exact time!!
- To verifying this, create an alternate key on the auto-number attribute.
The flow run will fail if the bespoke auto-numbering system tried to insert the same values against the record.
Tîpp Jäår $0.02 + GST
- It’s been a while since I implemented an auto-numbering system that required testing. Why? Because Common Data Service supports auto-numbering. Having said that, I have seen autonumbering requirements in the wild that wouldn’t fit on one page and require a team of 3 or more software engineers to implement. Those exactly are the occasions where you’d want to test. Or change the requirements. Or job.
- Don’t restrict your imagination to auto-numbers. There are plenty of other situations where you’d want to test records be created at the same time.
- Be aware of the Flow limits – those would be very easy to break while doing loop-de-loop.
Cover photo by Pixabay