Use a Business Rule to Keep Records from Closing in Microsoft Dynamics 365 CRM

Sometimes, you may want a user to fill in a field before closing a record in Dynamics 365 CRM, but the field you want the user to complete is not a required field. That’s because it’s not needed when the record is first created. For example, the Location field on the Appointment record is not a required field—you don’t need to fill it in when creating an Appointment record. But, for reporting purposes, you may want that field to be filled out before the Appointment record is closed.

You can set up a Business Rule to keep the record from closing and generate an error message for the user.

For the rule to work, you need to set the Business Role Scope to Entity (as shown below). This way, the rule acts like a plugin instead of JavaScript. (JavaScript can’t prevent the record from closing before sending an alert to the user.)

Here’s what the Business Rule logic would look like for the location scenario described above.

If Status = Completed AND Location does not contain data, then show an error message on the Location field.

In the software, it looks like this:

When you activate this rule and a user tries to close an Appointment record without filling in the Location field, they will get an error message like the one below telling them they must fill in the Location field before closing the Appointment.

The user can simply click the “OK” button, fill in the Location field, and close the Appointment.

This is one easy way to ensure data validation on non-required fields in records before the records are closed.

By Dave Packard, CRM Consultant & Project Manager