Tip #1356: Handle mandatory autonumber fields in automation

The usual workaround for dealing with business required fields when creating records in automation is to make them non-required, deal with the automation and then switch the required option back on.

Now, add an autonumber on top of that. That’s right, you want the mandatory field to be blank so that the generator kicks in. “Who would make an autonumber field a business required one?!” you’d ask and be absolutely right. But someone designing salesorder entity thought they know better and made ordernumber both autonumber and business required. And, before you ask, no, you cannot change business required setting.

“What’s the big deal” – you say – “just move the field to the header and forget about it”. And you’d be absolutely right if we didn’t talk about automation. Looks like Power Automate (which you should be using) handles it graciously and does not insist on you filling in order number for new records. Workflow (synchronous it must be), however, knows better, and puts the order number under Other fields section and insists on you filling it in.

That’s the pickle I found myself in. It only shows how often do I touch out of the box Dynamics 365 Sales entities but

How on Earth people were creating salesorders in workflows all this time?!

The Enabler

Maybe I’m missing something trivial (it happened more than once before, you know) but my layman workaround is to set the field to something that is [almost] guaranteed to be empty. How about Address 2: UPS Zone of the owning user? Done!

Autonumber and I are both happy now. Of course, as my luck would have it, the client is almost guaranteed to repurpose this field next month to store Secret Santa assignee. Because, you know, who would in their mind use Address 2: UPS Zone for anything?!

Cover photo by Digital Buggu from Pexels