Microsoft Power Platform offers various tools and features which can effectively create business solutions. One of these features is Dataverse, a secure and scalable data platform designed for ease of use for developing apps. In the context of the PL-100 (Microsoft Power Platform App Maker) exam, understanding how to create business rules in the Dataverse becomes vital.
An Overview of Dataverse Business Rules
Dataverse Business Rules provide a mechanism to implement business logic within your apps, without the need to write code. Business rules enable you to set up specific actions or display error messages based on conditions. Essentially, these rules provide a declarative way to write business logic that must be implemented on the client side.
They help to apply business rules at an entity level. This implies that the rules will apply to all the forms and applications interfacing with the respective entity.
Steps to create Business Rules in Dataverse
- Accessing Business Rules Interface: From make.powerapps.com, select the Data tab from the left-hand navigation. Click on “Tables,” select the table where you want to add a business rule, and from the business rule tab, click on “Add Business Rule.”
- Configuring the Business Rule: Use the Business Rule designer to design your rule. You will see two elements: “Condition” and “Action.” At least one Condition and one Action are required for a business rule to work.
You can define the condition based on the field’s values and the actions that need to be taken when the condition is true. You can also add else conditions and actions. Several actions are available like: Show error message, Set field value, Set business required, Set visibility, Lock or unlock field, and more.
- Validating and Applying: Once the business rule’s conditions and actions are set, click on “Validate” to check for any errors. After validation, click on “Apply” to complete the creation.
- Activate the Business Rule: Remember that the rule doesn’t take effect until it is activated. To activate, click on the “Activate” button.
For example, suppose you have a custom field named “Expiry Date” in the “Orders” table. You want to create a business rule that whenever the ‘Expiry Date’ is less than the current date, the ‘Order Status’ should set to ‘Expired’.
Here’s a basic way to achieve this:
- Click on “Add condition”, and select the ‘Field’ as ‘Expiry Date’, ‘Operator’ as ‘Less than’, and ‘Type’ as ‘Local Date and Time’.
- Under the ‘True’ action, click on “Add action”, and select the ‘Action’ as ‘Set Field Value’. Choose ‘Field’ as ‘Order Status’ and ‘Value’ as ‘Expired’.
After setting this rule, if an order’s expiry date is less than the current date, the status will automatically set to ‘Expired’.
Thus, the creation and utilization of business rules in the Microsoft Dataverse greatly enables business process automation. Without writing complicated code, app makers can now implement and enforce business-specific rules and logic to automate and enhance data consistency in the Power Apps. With the right knowledge and training, these tools are a force multiplier in the app development process.
Practice Test
True or False: Dataverse business rules allow you to apply form logic without needing to write JavaScript code.
- True
- False
Answer: True
Explanation: Dataverse business rules are aimed at enabling business analysts and power users to configure Microsoft Dataverse without writing code.
A Dataverse business rule should only be used if you want to perform a complex calculation.
- True
- False
Answer: False
Explanation: Dataverse business rules can be used for a variety of tasks including setting field values, clearing field values, validating data and displaying error messages, and not just for complex calculations.
Which of the following is NOT a type of action you can perform with Microsoft Dataverse Business Rules?
- A. Show/Hide fields
- B. Set field values
- C. Create new database tables
- D. Validate data and show error messages
Answer: C. Create new database tables
Explanation: Microsoft Dataverse business rules allow for actions such as showing or hiding fields, setting field values, and validating data. They do not allow for the creation of new database tables directly.
Business rules in Dataverse run on both the client and server side.
- True
- False
Answer: True
Explanation: Business rules run on both the client and the server side. This means they work regardless of the platform on which the app is run — web, tablet, or phone.
True or False: It’s mandatory to use a condition in a business rule in Dataverse.
- True
- False
Answer: False
Explanation: Conditions in business rules are optional and can be used based on specific needs.
Multiple select: Which of the below conditions can be used in a business rule?
- A. Field value equals a specified value
- B. Field value does not equal a specified value
- C. Field contains data
- D. Field value equals an unsupported data type
Answer: A. Field value equals a specified value, B. Field value does not equal a specified value, C. Field contains data
Explanation: Dataverse business rules support several conditions, but unsupported data types cannot be used as a condition in business rules.
In Dataverse, business rules are only executed when a record is created and not when it’s updated.
- True
- False
Answer: False
Explanation: Business rules in Dataverse can be set to execute when a record is created, updated, or both.
Single select: To use a business rule in a Canvas app within PowerApps, it must be:
- A. Inactive
- B. Active
- C. In draft state
- D. Deleted
Answer: B. Active
Explanation: For any business rule in Dataverse to be used, it must be in an active state.
Business rules in Dataverse are only applicable at the entity level.
- True
- False
Answer: False
Explanation: Business rules in Dataverse can operate at both the entity level and the specific field level, depending on the need of the task at hand.
Single select: Which permission is necessary to manage business rules in Dataverse?
- A. Environment Maker
- B. System Administrator
- C. Common Data Service User
- D. Dynamics 365 Customer Engagement Plan User
Answer: B. System Administrator
Explanation: The System Administrator security role or equivalent permissions are needed to manage business rules in Dataverse.
Interview Questions
What is the function of business rules in Dataverse?
Business rules in Dataverse provide a way to apply logic and validations at the data layer level without needing to write JavaScript or .NET code.
How does the scope of a business rule in Dataverse impact its performance?
The scope determines the level at which the business rule is applied. It can be set at Entity, All Forms, or specific forms. A larger scope can have a wider impact and could lead to performance considerations.
What happens when a business rule in Dataverse fails to execute?
Typically, when a business rule fails to execute, the system falls back on the client-side logic. If there’s any problem with the client-side logic as well, the user will encounter an error.
Can a business rule in Dataverse be used to enforce complex business logic or validation?
While business rules can manage basic validations and logic, complex business scenarios often require plugins or custom code to be properly handled.
What are the two primary execution contexts for business rules in Dataverse?
The two main execution contexts for Dataverse business rules are Client and Server.
Do business rules in Dataverse work offline?
Yes, as long as the business rules are applied to the client and do not rely on server-side logic, they can operate offline.
How would you create a new business rule in the Microsoft Dataverse?
To create a business rule, you’ll need to open the Solution window, select Components > Entities > Entity > Business Rules, and then click New Business Rule.
What types of actions can be performed using business rules in Dataverse?
Business rules in Dataverse can perform various actions such as Show error message, Set field value, Set business required, Set default value, Lock or unlock field.
Are business rules applied to all forms or can they be set to specific ones?
The scope of business rules can be set to all forms in an entity or to specific forms as needed.
Can the order of operations for multiple business rules in Dataverse be specified?
No, the order of execution cannot be guaranteed for multiple business rules in Dataverse. It’s best to create business rules that are independent of one another or to combine related rules into one where possible.
Can you deactivate a business rule in Dataverse?
Yes, you can deactivate a business rule in Dataverse by opening the business rule from the entity definition and clicking Deactivate.
Can you inherit business rules to child classes in a Dataverse?
No, business rules are not inheritable to child classes as they are associated with specific entities.
Can we use Plug-ins instead of business rules in Dataverse?
Yes, plug-ins can be used to implement complex business logic that is not achievable with business rules.
What will happen if a business rule is not saved and activated?
If a business rule is not saved and activated, the rule will not be executed. It needs to be activated to reflect its changes.
Can business rules in Dataverse work on both client and server side?
Yes, from Dataverse version 9.0, business rules can execute at both client side and server side.