Dynamics 365 Business Central: Company Name, Company Display Name, and Company URL Name

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about Company Name, Company Display Name and Company URL Name in Business Central. And how to get them easily in AL.

First let’s look at Company Name and Company Display Name.
Open the Companies page.

Company Name: The name of a company. This is the primary key of the Company table.
For example, My Company 02

Company Display Name: The name to display for the company in the user interface. This is the most common name for users, and this name can be the same as Company Name.
For example, My Company 02 Display Name

After logging in to BC, the Company Display Name is displayed in the upper left corner of the Role Center.

This Display Name is always displayed on the first page that opens, and clicking on it will take you back to the Role Center.

And it also shows Company Display Name in My Settings page.

Company URL Name: The string that represents the company name in a URL.
For example, My%20Company%2002

In BC URL:

In Web Service or APIs:

Therefore, it is very important to know the right company name to use in our customization.

Next let’s see how to get them in AL. It is also very simple.

For Company Name:
Using Database.CompanyName() Method: Gets the current company name.

For Company Display Nameand Company URL Name:
Using CompanyProperty Data Type: Provides language support for company properties.

The following methods are available on the CompanyProperty data type.

Method nameDescription
DisplayName()Gets the current company display name.
UrlName()Gets the string that represents the company name in a URL.

For example,

Source Code:

pageextension 50123 MyExtension extends "Customer List"
{
    trigger OnOpenPage()
    var
        Msg: Label 'Company Name is ''%1''\\Company Display Name is ''%2''\\Company URL Name is ''%3''';
    begin
        Message(Msg, CompanyName, CompanyProperty.DisplayName(), CompanyProperty.UrlName());
    end;
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

タイトルとURLをコピーしました