You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/maker/data-platform/data-platform-create-business-rule.md
+40-12Lines changed: 40 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,9 @@ title: Create a business rule in Microsoft Dataverse | Microsoft Docs
3
3
description: Step-by-step instructions for how to create a business rule in Microsoft Dataverse.
4
4
author: lancedMicrosoft
5
5
manager: kvivek
6
-
7
6
ms.component: cds
8
7
ms.topic: how-to
9
-
ms.date: 03/21/2018
8
+
ms.date: 04/05/2022
10
9
ms.subservice: dataverse-maker
11
10
ms.author: lanced
12
11
ms.reviewer: matp
@@ -38,7 +37,7 @@ By combining conditions and actions, you can do any of the following with busine
38
37
39
38
## Differences between canvas and model-driven apps
40
39
41
-
Model driven apps can use all actions available on business rules, however not all business rule actions are available for canvas apps at this time. The following actions are **not** available on Canvas apps:
40
+
Model driven apps can use all actions available on business rules, however not all business rule actions are available for canvas apps at this time. The following actions are **not** available on canvas apps:
42
41
43
42
* Show or hide columns
44
43
* Enable or disable columns
@@ -96,7 +95,7 @@ Business rules work with most column types including text, number, choice, date,
96
95
97
96
8.**Add actions.** To add an action:
98
97
99
-
1. Drag one of the action components from the **Components** tab to a plus sign next to **Condition** component. Drag the action to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition is not met.
98
+
1. Drag one of the action components from the **Components** tab to a plus sign next to **Condition** component. Drag the action to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition isn't met.
100
99
101
100

102
101
@@ -106,7 +105,7 @@ Business rules work with most column types including text, number, choice, date,
106
105
107
106
9.**Add a business recommendation (model-driven apps only)**. To add a business recommendation:
108
107
109
-
1. Drag the **Recommendation** component from the **Components** tab to a plus sign next to a **Condition** component. Drag the **Recommendation** component to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition is not met.
108
+
1. Drag the **Recommendation** component from the **Components** tab to a plus sign next to a **Condition** component. Drag the **Recommendation** component to a plus sign next to a check mark if you want the business rule to take that action when the condition is met, or to a plus sign next to an x if you want the business rule to take that action if the condition isn't met.
110
109
111
110
2. To set properties for the recommendation, select the **Recommendation** component in the designer window, and then set the properties in the **Properties** tab.
112
111
@@ -128,26 +127,55 @@ Business rules work with most column types including text, number, choice, date,
128
127
> - To take a snapshot of everything in the **Business Rule** window, select **Snapshot** on the action bar. This is useful, for example, if you want to share and get comments on the business rule from a team member.
129
128
> - Use the mini-map to navigate quickly to different parts of the process. This is useful when you have a complicated process that scrolls off the screen.
130
129
> - As you add conditions, Actions, and business recommendations to your business rule, Dataverse builds the code for the business rule at the bottom of the designer window. This code is read only.
131
-
130
+
131
+
## Example: Create a business rule for tasks older than 30 days
132
+
133
+
This business rule example creates a condition that triggers a message in the task description field when a task is more than 30 days old.
134
+
135
+
1. Sign in to [Power Apps](https://make.powerapps.com/?utm_source=padocs&utm_medium=linkinadoc&utm_campaign=referralsfromdoc), on the left navigation pane expand **Data**.
136
+
1. In the list that appears, select **Tables**.
137
+
1. Open the **Task** table, and then select the **Business rules** tab.
138
+
1. Select **Add business rule**.
139
+
1. Select **New Condition** on the business process flow canvas, and enter or select the following properties:
140
+
-**Display name**: *Task is more than 30 days old*
141
+
-**Entity**: **Task**
142
+
-**Rule 1**
143
+
-**Source**: **Entity**
144
+
-**Field**: **Created On**
145
+
-**Operator**: **+**
146
+
-**Type**: **Value**
147
+
-**Days**: *30*
148
+
-**Condition Expression** (automatically created): **(Created On Is greater than [Created On + 30])**
149
+
1. Select **Apply**.
150
+
1. Select **Add** > **Add Show Error Message**.
151
+
1. In the **Show Error Message Properties** tab, enter the following properties:
152
+
-**Display Name**: *Task is more than 30 days old*
153
+
-**Entity**: **Task**
154
+
-**Error Message**:
155
+
-**Field**: **Description**
156
+
-**Message**: *This task is more than 30 days old!*
157
+
1. Select **Apply**.
158
+
1. Select **Save**.
159
+
132
160
## Localize error messages used in business rules
133
161
134
-
If you have more than one language provisioned for your organization, you will want to localize any error messages that you have set. Each time you set a message, a label is generated by the system. If you export the translations in your organization, you can add localized versions of your messages and then import those labels back into the Dataverse, so that people using languages other than your base language can view the translated messages.
162
+
If you've more than one language provisioned for your organization, you'll want to localize any error messages that you have set. Each time you set a message, a label is generated by the system. If you export the translations in your organization, you can add localized versions of your messages and then import those labels back into the Dataverse, so that people using languages other than your base language can view the translated messages.
135
163
136
164
## Common issues
137
165
138
166
This section describes common issues that may occur when you use business rules.
139
167
140
168
### Composite attributes not supported with Unified Interface apps
141
169
142
-
Actions or conditions that use [Composite attributes](../../developer/model-driven-apps/clientapi/reference/composite-attributes.md)are not supported in apps based on the Unified Interface. Alternatively, you can use actions or conditions on the attributes that comprise the composite attributes. For example, instead of using the **Full Name** (fullname) attribute, you can use the **First Name** (firstname) and **Last Name** (lastname) attributes.
170
+
Actions or conditions that use [Composite attributes](../../developer/model-driven-apps/clientapi/reference/composite-attributes.md)aren't supported in apps based on the Unified Interface. Alternatively, you can use actions or conditions on the attributes that comprise the composite attributes. For example, instead of using the **Full Name** (fullname) attribute, you can use the **First Name** (firstname) and **Last Name** (lastname) attributes.
143
171
144
172
### Is your business rule not firing for a form?
145
173
146
174
A business rule may not execute because the field referenced in the business rule isn’t included with the form.
147
175
1. Open [solution explorer](../model-driven-apps/advanced-navigation.md#solution-explorer). Expand the entity that you want and then select **Forms**.
148
176
2. Open the form that you want and then on the form designer ribbon select **Business Rules**.
149
177
3. In the form designer, open the business rule.
150
-
4. In the business rule designer select each condition and action to verify all the fields referenced in each condition and action.
178
+
4. In the business rule designer, select each condition and action to verify all the fields referenced in each condition and action.
151
179
152
180
> [!div class="mx-imgBorder"]
153
181
> 
@@ -163,13 +191,13 @@ A business rule may not execute because the field referenced in the business rul
163
191
- Yes, a business rule can unlock fields and edit actions on a read-only form.
164
192
165
193
*How do I troubleshoot a business rule that isn't working?*
166
-
- See [Is your business rule not firing for a form?](#is-your-business-rule-not-firing-for-a-form) in this topic.
194
+
- See [Is your business rule not firing for a form?](#is-your-business-rule-not-firing-for-a-form) in this article.
167
195
168
196
*Do business rules react to changes made by an onLoad script?*
169
-
- No, they will execute before an onload script is executed.
197
+
- No, they'll execute before an onload script is executed.
170
198
171
199
*When I update a business rule, is it executed against all existing records?*
172
-
- No. Business rules are run on clients. For example, they run when a form is opened by a user and when a field value changes on that open form. They are not executed inside Dataverse.
200
+
- No. Business rules are run on clients. For example, they run when a form is opened by a user and when a field value changes on that open form. They aren't executed inside Dataverse.
0 commit comments