May 26, 2024

Patching blank values into mandatory fields in a Canvas App

Although it's possible to create a record in Power Automate that bypasses mandatory fields by sending a null value, how is the same achieved in a Canvas App?

You may have come across this scenario yourself when creating new records via the Patch command with something like this:

Patch(
   Accounts, Defaults(Accounts),
      {'Account Name':"Test Account"}
)

only to be told that one of the fields your not setting is actually mandatory. In the past, you could bypass this by including something like: 'Account Number':Blank() but in more recent version of Power Apps, it seems this is no longer possible. So how is it achieved now? It's actually even simpler now - just pass "", so:

Patch(
   Accounts, Defaults(Accounts),
      {'Account Name':"Test Account", 'Account Number':""}
)

I've tested this with a text field in Dataverse and then running a query after it and it still sees the field as empty rather than having an empty string.

UPDATE 3/9/2024 - I've since tested this with a mandatory whole number field and have yet to find a way to bypass the requirement. Neither Blank() and "" work and pushing a zero in there might not be ideal. I ended up removing the requirement at the column level to make it optional and then forced it to be mandatory at form level instead.

Freezepop.co.uk

Informational site covering the Microsoft Power Platform, including Power Apps, Power Automate and Power BI.