Skip to content

Commit fc9d6f3

Browse files
authored
Merge pull request #1235 from MicrosoftDocs/master
Pushing content live
2 parents 9192f6a + b0d613b commit fc9d6f3

File tree

2 files changed

+80
-45
lines changed

2 files changed

+80
-45
lines changed

powerapps-docs/developer/model-driven-apps/define-ribbon-enable-rules.md

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
title: "Define ribbon enable rules (model-driven apps) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces"
33
description: "Learn about defining specific rules to control when the ribbon elements are enabled during configuration of ribbon elements." # 115-145 characters including spaces. This abstract displays in the search result."
44
keywords: ""
5-
ms.date: 10/31/2018
5+
ms.date: 02/08/2019
66
ms.service:
77
- "powerapps"
88
ms.custom:
99
- ""
1010
ms.topic: article
1111
ms.assetid: 201f5db9-be65-7c3b-8202-822d78338bd6
12-
author: JimDaly # GitHub ID
13-
ms.author: jdaly # MSFT alias of Microsoft employees only
14-
manager: shilpas # MSFT alias of manager or PM counterpart
15-
ms.reviewer:
12+
author: JesseParsons
13+
ms.author: jeparson
14+
manager: annbe
15+
ms.reviewer: kvivek
1616
search.audienceType:
1717
- developer
1818
search.app:
@@ -22,8 +22,6 @@ search.app:
2222

2323
# Define ribbon enable rules
2424

25-
<!-- https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/customize-dev/define-ribbon-enable-rules -->
26-
2725
When configuring Ribbon elements you can define specific rules to control when the ribbon elements are enabled. The `<EnableRule>` element is used as follows:
2826

2927
- Use the `/RuleDefinitions/EnableRules/EnableRule` element to define rules controlling when the ribbon element should be enabled.
@@ -48,9 +46,9 @@ When configuring Ribbon elements you can define specific rules to control when t
4846

4947
| Value | Presentation |
5048
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
51-
| `Modern` | The command bar is presented using Dynamics 365 for tablets. |
49+
| `Modern` | The command bar is presented using [!INCLUDE[pn_moca_full](../../includes/pn-moca-full.md)]. |
5250
| `Refresh` | The command bar is presented using the updated user interface. |
53-
| `Legacy` | The ribbon is presented in forms for entities that were not updated or in a list view in Dynamics 365 for Outlook. |
51+
| `Legacy` | The ribbon is presented in forms for entities that were not updated or in a list view in [!INCLUDE[pn_crm_for_outlook_full](../../includes/pn-crm-for-outlook-full.md)]. |
5452

5553
### Crm Client Type Rule
5654
Uses the `<CrmClientTypeRule>` element to allow definition of rules depending on the type of client used. Type options are as follows:
@@ -60,27 +58,64 @@ Uses the `<CrmClientTypeRule>` element to allow definition of rules depending o
6058
- `Outlook`
6159

6260
### Crm Offline Access State Rule
63-
Uses the `<CrmOfflineAccessStateRule>` element. Use this criteria to enable a ribbon element based on whether Dynamics 365 for Microsoft Office Outlook with Offline Access is currently offline.
61+
Uses the `<CrmOfflineAccessStateRule>` element. Use this criteria to enable a ribbon element based on whether [!INCLUDE[pn_crm_outlook_offline_access](../../includes/pn-crm-outlook-offline-access.md)] is currently offline.
6462

6563
### Crm Outlook Client Type Rule
66-
Uses the `<CrmOutlookClientTypeRule>` element. Use this rule if you want to only display a button for a specific type of Dynamics 365 for Outlook. Type options are as follows:
64+
Uses the `<CrmOutlookClientTypeRule>` element. Use this rule if you want to only display a button for a specific type of [!INCLUDE[pn_crm_for_outlook_full](../../includes/pn-crm-for-outlook-full.md)]. Type options are as follows:
6765

6866
- `CrmForOutlook`
6967

7068
- `CrmForOutlookOfflineAccess`
7169

7270
### Custom Rule
73-
Uses the `<CustomRule>` element. Use this kind of rule to call a function in a JavaScript Library that returns a Boolean value.
71+
Uses the `<CustomRule>` element. Use this kind of rule to call a function in a JavaScript library that returns a Promise (Unified Interface) or boolean (Unified Interface and web client).
72+
73+
```JavaScript
74+
function EnableRule()
75+
{
76+
const value = Xrm.Page.getAttribute("field1").getValue();
77+
return value === "Active";
78+
}
79+
```
7480

7581
> [!NOTE]
76-
> Custom rules that do not return a value quickly can affect the performance of the ribbon. If you have to perform logic that might take some time to complete, use the following strategy to make your custom rule asynchronous:
77-
>
78-
> 1. Define a rule that checks for a custom object. You might check for an object such as `Window.ContosoCustomObject.RuleIsTrue` that you just attach to the Window.
79-
> 2. If that object exists, return it.
80-
> 3. If that object does not exist, define the object and set the value as false.
81-
> 4. Before you return a value, use [settimeout](https://msdn.microsoft.com/library/ms536753\(VS.85\).aspx) <!-- TODO not sure about this link--> to execute an asynchronous callback function to re-set the object. Then return false.
82-
> 5. After the callback function has performed the operations that are required to determine the correct result, it sets the value of the object and uses the `refreshRibbon` method to refresh the ribbon.
83-
> 6. When the ribbon is refreshed, it detects the object together with the accurate value set and the rule is evaluated.
82+
> Custom rules that do not return a value quickly can affect the performance of the ribbon. If you have to perform logic that might take some time to complete (for example, a network request), use the following strategy to make your custom rule asynchronous.
83+
84+
Unified Interface rules support returning a Promise rather than boolean for asynchronous rule evaluation. If the promise does not resolve within 10 seconds, the rule will resolve with a false value.
85+
> [!NOTE]
86+
> Promises-based rules will only work on Unified Interface, so they cannot be used if classic Web Client is still being used.
87+
```JavaScript
88+
function EnableRule()
89+
{
90+
const request = new XMLHttpRequest();
91+
request.open('GET', '/bar/foo');
92+
93+
return new Promise((resolve, reject) =>
94+
{
95+
request.onload = function (e)
96+
{
97+
if (request.readyState === 4)
98+
{
99+
if (request.status === 200)
100+
{
101+
resolve(request.responseText === "true");
102+
}
103+
else
104+
{
105+
reject(request.statusText);
106+
}
107+
}
108+
};
109+
request.onerror = function (e)
110+
{
111+
reject(request.statusText);
112+
};
113+
114+
request.send(null);
115+
});
116+
}
117+
```
118+
84119

85120
### Entity Rule
86121
Uses the `<EntityRule>` element. Entity rules allow for evaluation of the current entity. This is useful when you define custom actions that apply to the Entity Template instead of for specific entities. For example, you may want to add a ribbon element to all entities except for several specific entities. It is easier to define the custom action for the Entity Template that applies to all entities and then use an Entity Rule to filter out those that should be excluded.
@@ -104,10 +139,10 @@ Uses the `<CrmClientTypeRule>` element to allow definition of rules depending o
104139
Uses the `<OrRule>` element. The `OrRule` lets you override the default AND comparison for multiple enable rule types. Use the `OrRule` element to define several possible valid combinations to check.
105140

106141
### Outlook Item Tracking Rule
107-
Uses the `<OutlookItemTrackingRule>` element. Use the `TrackedInCrm` attribute for this element to determine whether the record is being tracked in Common Data Service for Apps.
142+
Uses the `<OutlookItemTrackingRule>` element. Use the `TrackedInCrm` attribute for this element to determine whether the record is being tracked in PowerApps.
108143

109144
### Outlook Version Rule
110-
Uses the `<OutlookVersionRule>` element. Use this to enable a ribbon element for a specific version of Office Outlook as follows:
145+
Uses the `<OutlookVersionRule>` element. Use this to enable a ribbon element for a specific version of [!INCLUDE[pn_MS_Outlook_Full](../../includes/pn-ms-outlook-full.md)] as follows:
111146

112147
- `2003`
113148

@@ -124,17 +159,8 @@ Uses the `<CrmClientTypeRule>` element to allow definition of rules depending o
124159
### Selection Count Rule
125160
Uses the `<SelectionCountRule>` element. Use this kind of rule with a ribbon displayed for a list to enable a button when specific maximum and minimum numbers of records in the grid are selected. For example, if your button merges records, you should make sure at least two records are selected before enabling the ribbon control.
126161

127-
### Sku Rule
128-
Uses the `<SkuRule>` element. Use this kind of rule to enable a ribbon element for a specific SKU version of Dynamics 365 as follows:
129-
130-
- `OnPremise`
131-
132-
- `Online`
133-
134-
- `Spla`
135-
136162
### Value Rule
137-
Uses the `<ValueRule>` element. Use this rule to check the value of a specific field in the record being displayed in the form. You must specify the `Field` and the `Value` to check.
163+
Uses the `<ValueRule>` element. Use this rule to check the value of a specific field in the record being displayed in the form. You must specify the `Field` and the `Value` to check.
138164

139165
### See also
140166
[Customize commands and the ribbon](customize-commands-ribbon.md)

powerapps-docs/maker/common-data-service/create-edit-fields.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "How to create and edit fields for Common Data Service for Apps| MicrosoftDocs"
33
ms.custom: ""
4-
ms.date: 05/18/2018
4+
ms.date: 02/08/2019
55
ms.reviewer: ""
66
ms.service: "crm-online"
77
ms.suite: ""
@@ -14,7 +14,7 @@ applies_to:
1414
ms.assetid: d88677fa-2caf-47b0-aec6-10a25a7ec9c3
1515
caps.latest.revision: 55
1616
ms.author: "matp"
17-
manager: "brycho"
17+
manager: "kvivek"
1818
search.audienceType:
1919
- maker
2020
search.app:
@@ -43,18 +43,27 @@ There are two designers you can use to create or edit fields:
4343
4444
Information in this topic will help you choose which designer you can use.
4545

46-
You should use the PowerApps portal to Create and edit fields for Common Data Service for Appsunless you need to address any of the following requirements:
46+
You should use the PowerApps portal to Create and edit fields for Common Data Service for Apps unless you need to address any of the following requirements:
4747

48-
- Create a Customer Lookup field
49-
- Create a field in a solution other than the CDS Default solution
50-
- Define status reason transitions
51-
- Edit multiple fields at once
52-
- Enable Auditing
53-
- Enable Field Level Security
54-
- Select whether the field appears in global filter in interactive experience
55-
- Select whether the field is sortable in interactive experience dashboards
56-
- Set a field Requirement Level as Business Recommended
57-
- Set managed properties for a field
48+
- Create a Customer Lookup field.
49+
- More information: [Different types of lookups](types-of-fields.md#different-types-of-lookups)
50+
- Create a field in a solution other than the CDS Default solution.
51+
- More information: [Solutions overview](solutions-overview.md)
52+
- Define status reason transitions.
53+
- More information: [Define status reason transitions for the Case or custom entities](define-status-reason-transitions.md)
54+
- Edit multiple fields at once.
55+
- Enable Auditing.
56+
- More information: [Auditing overview](../../developer/common-data-service/auditing-overview.md)
57+
- Enable Field Level Security.
58+
- More information: [Field security entities](../../developer/common-data-service/field-security-entities.md)
59+
- Select whether the field appears in global filter in interactive experience.
60+
- More information: [Configure model-driven app interactive experience dashboards](../model-driven-apps/configure-interactive-experience-dashboards.md)
61+
- Select whether the field is sortable in interactive experience dashboards.
62+
- More information: [Configure model-driven app interactive experience dashboards](../model-driven-apps/configure-interactive-experience-dashboards.md)
63+
- Set a field Requirement Level as Business Recommended.
64+
- More information: [Create business rules and recommendations to apply logic in a model-driven app form](../model-driven-apps/create-business-rules-recommendations-apply-logic-form.md)
65+
- Set managed properties for a field.
66+
- More information: [Set managed properties for fields](set-managed-properties-for-field.md)
5867

5968
> [!NOTE]
6069
> You can create a Lookup field in the PowerApps portal or in solution explorer by creating a One-to-many relationship on the entity. But only solution explorer offers the option to create this relationship while creating a field.

0 commit comments

Comments
 (0)