Set different control properties

Completed

Different controls have different properties, such as NotBlank, ShowMandatory, UpdatePropagation, and ApplicationArea.

NotBlank and ShowMandatory

The NotBlank property is used on the field level and the control level. You can find this property on the fields of a table or on the control of a page.

NotBlank indicates that the field is mandatory. It displays an error when the user attempts to save with a blank mandatory field. If you set this property on the field level, it will always be mandatory on the control level.

The ShowMandatory property only gives you a visual indication that a field is mandatory. It doesn't give an error if you leave the field blank. The indication is noted with a red asterisk.

Screenshot showing the ShowMandatory property alert.

UpdatePropagation

The UpdatePropagation property provides an answer to what must happen when a subpage is updated. For example, it will answer whether the mainpage should be updated as well.

This property has two options:

  • Subpage - Won't update the mainpage

  • Both - Will result in an update of the subpage and the mainpage

ApplicationArea

Application areas represent a feature in the system that offers developers, administrators, and users the ability to define differentiated user experiences. They are mapped to controls to show or hide them on page objects to enable more or fewer business scenarios. Page controls or actions without application areas aren't displayed in cloud experiences.

The ApplicationArea property is found on the page but also on field, part, and action controls. It's a text string that contains a comma-separated list of application area tags. The ApplicationArea property will hide or show certain controls on a page, depending on which license the end user is using (Essentials or Premium).

An application area tag must have the format name, where name is the application area. It can be a combination of letters and numbers without spaces. To specify the Basic and Suite application areas, the property can be set to Basic,Suite.

You can set the property to All when the control applies to all application areas. Setting the property to All means that the control will always appear in the user interface.

If one or more application areas are enabled in a session, any controls that aren't tagged with an application area won't appear in the user interface.

When targeting runtime version 10.0 (that is, 2022 release wave 2) or higher:

  • Page controls without the ApplicationArea property explicitly set inherit the ApplicationArea defined on the parent page (or report if request page).

  • Rules AS0062 and PTE0008 have been updated so you don't need to specify an explicit ApplicationArea on the page control, as long as it is set on the parent object level, thereby providing a default.

  • ApplicationArea can be used without UsageCategory on pages to provide a default fallback for controls, without forcing search visibility.

  • No impact on search; UsageCategory and ApplicationArea are still both required.

  • No impact on page (or report) extensions; values must still be set explicitly there.

UsageCategory

The UsageCategory property is a required setting used together with the ApplicationArea property. This enables a page or a report to be available in Search for the navigation support.

The Business Central client includes the Tell me feature, often referred to as Search for Page, that lets users find objects by entering search terms. When you have added a page or a report in your extension, you most likely want it to be discoverable to users in Tell me. In AL, you make a page or report searchable from Tell me by setting the UsageCategory property in code. The UsageCategory setting will make the page or report searchable, and the value chosen for the setting will further sub-categorize the item.

When you create a Page or a Report, you add the UsageCategory property. If the UsageCategory property is set to None, or if you don't specify UsageCategory, the page or report won't show up when you search in Dynamics 365 Business Central.

You can specify other words or phrases that can help users find a page or report by using the AdditionalSearchTerms and AdditionalSearchTermsML properties. If the page or report is searchable by Tell me (that is, the UsageCategory property is set a value other than None), the search terms specified by these properties are used in addition to the caption of the page or report. These properties are useful when the caption doesn't always reflect what users will look for. A good example of this in Business Central is pages and reports associated with items. Users unfamiliar with Business Central might look for product or merchandise instead of items.

The following example creates a SimpleItemList page and sets a UsageCategory property to the page, so that the SimpleItemList page is discoverable through search using the Tell me feature. Also, the example sets the AdditionalSearchTerms property to add two search terms for the page.

al-languageCopy
page 50210 SimpleItemList 
{ 
    PageType = List; 
    SourceTable = Item; 
    UsageCategory = Lists;
    AccessByPermission = page SimpleItemList = X;
    ApplicationArea = All;
    AdditionalSearchTerms = 'product, merchandise';

    layout 
    { 
        area(content) 
        { 
            group(General) 
            { 
                field("No.";"No.") {} 
                field(Name;Name) {} 
                field(Description;Description) {} 
            } 
        } 
    } 
}