Skip to content

Commit 07e5df0

Browse files
authored
Merge pull request #6153 from MicrosoftDocs/matp-2669165
Matp 2669165
2 parents 329d5fa + b91b2dd commit 07e5df0

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

powerapps-docs/maker/data-platform/data-platform-create-business-rule.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ title: Create a business rule in Microsoft Dataverse | Microsoft Docs
33
description: Step-by-step instructions for how to create a business rule in Microsoft Dataverse.
44
author: lancedMicrosoft
55
manager: kvivek
6-
76
ms.component: cds
87
ms.topic: how-to
9-
ms.date: 03/21/2018
8+
ms.date: 04/05/2022
109
ms.subservice: dataverse-maker
1110
ms.author: lanced
1211
ms.reviewer: matp
@@ -38,7 +37,7 @@ By combining conditions and actions, you can do any of the following with busine
3837

3938
## Differences between canvas and model-driven apps
4039

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:
4241

4342
* Show or hide columns
4443
* Enable or disable columns
@@ -96,7 +95,7 @@ Business rules work with most column types including text, number, choice, date,
9695

9796
8. **Add actions.** To add an action:
9897

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.
10099

101100
![Drag an action to a business rule.](./media/data-platform-cds-create-business-rule/drag-an-action-business-rule.png "Drag an action to a business rule")
102101

@@ -106,7 +105,7 @@ Business rules work with most column types including text, number, choice, date,
106105

107106
9. **Add a business recommendation (model-driven apps only)**. To add a business recommendation:
108107

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.
110109

111110
2. To set properties for the recommendation, select the **Recommendation** component in the designer window, and then set the properties in the **Properties** tab.
112111

@@ -128,26 +127,55 @@ Business rules work with most column types including text, number, choice, date,
128127
> - 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.
129128
> - 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.
130129
> - 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+
132160
## Localize error messages used in business rules
133161

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.
135163

136164
## Common issues
137165

138166
This section describes common issues that may occur when you use business rules.
139167

140168
### Composite attributes not supported with Unified Interface apps
141169

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.
143171

144172
### Is your business rule not firing for a form?
145173

146174
A business rule may not execute because the field referenced in the business rule isn’t included with the form.
147175
1. Open [solution explorer](../model-driven-apps/advanced-navigation.md#solution-explorer). Expand the entity that you want and then select **Forms**.
148176
2. Open the form that you want and then on the form designer ribbon select **Business Rules**.
149177
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.
151179

152180
> [!div class="mx-imgBorder"]
153181
> ![Field referenced in business rule exists in entity.](media/data-platform-cds-create-business-rule/business-rule-field.png "Field referenced in business rule exists in entity")
@@ -163,13 +191,13 @@ A business rule may not execute because the field referenced in the business rul
163191
- Yes, a business rule can unlock fields and edit actions on a read-only form.
164192

165193
*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.
167195

168196
*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.
170198

171199
*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.
173201

174202
### See also
175203

0 commit comments

Comments
 (0)