Dynamics 365 Business Central Mini tips: How to get the current company display name quickly in AL

Dynamics 365 Business Central

Hi, Readers. Only one months’ left in 2020, I hope you and your family are doing well.
In this post, I want to share another mini tip of Dynamics 365 Business Central. How to get the current company display name quickly in AL.

Let’s take a look at the Company Display Name in Business Central first.
Role Center:

Companies page:

If you only want to get Company Name, you can use table 79 “Company Information”.
As follows:

Or use CompanyName Method directly.

But there is no Display Name field in this table.

So It is common practice to declare another variable (table 2000000006 Company) to get the display name.

Yes, you can get it without any problems, and it may not reduce performance of BC.

But, as the best practice to get the current company display name, it is recommended to use CompanyProperty.DisplayName Method.

Return Value: DisplayName
Type: String
The display name of the company as specified in the Display Name field in the Company table. If no display name is specified, the company name that is stored in the Name field is returned.

For example:

PS: You can also use CompanyProperty.UrlName to get the company name in a URL.

END

Hope this will help.

Thanks for your reading.

ZHU



コメント

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