Business Applications, dynamics 365, PowerApps, Uncategorized

Multiple ways to implement a required field validation in PowerApps. Part 1.

Implementing a required field validation is the way to force encourage a system user to enter the information which is critical for your business.

There are some options below to support this in PowerApps:

1.      Too Easy and too obvious. App level validation.

It’s a Card property on the Edit form. Select the card you want to make required. Unlock the card. Change the property from “false” to “true”.

v1

v2v3v4

It’s good because it’s easy. However, it only allows you to set it required for the particular app, let’s call it app level validation. Which is a valid scenario.

If you need to set it for all apps working with your CDS data source, you have to do it differently.

 

2.      The Required field in a CDS data source. Data source level validation.

Let’s make a Job Title field mandatory/required on a data source level.

v5

From the top menu click on File then on the left-hand side click on Connections. Then select Data and Entities under Data.

v6v7

Pick up the entity you are working with in your app. In my case it’s a Contact entity.

Click on the Contact entity then on the Fields tab then select the Job Title field from the list of fields.

v8

Tick the Required property on the right panel. Done.

Then Save Entity.

Go back to the app. After refreshing the screen, I still didn’t see any magic happening, so I had to re-add the card to the form.

v9

On the right-side Properties tab click on the X selected link for Fields.

Unselect the Job Title field then select it again.

v10

The result in Edit mode:

v11

The result after run:

v12

Note: The validation message doesn’t need to be that ugly. You can always style it your way.

To be continued…

1 thought on “Multiple ways to implement a required field validation in PowerApps. Part 1.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s