Dynamics 365 Business Central Mini tips: How to get Product Name

Dynamics 365 Business Central

Hi Readers.
This times I want to share another mini tip of Dynamics 365 Business Central.

How to get Product Name
When you want to refer to product name in informational messages or errors, hardcode the product name is obviously not a good practice, Such as ‘Business Central’. From NAV 2017, it’s recommended to use ProductName method that platform provides.
ProductName has 3 values, ProductName.Short()ProductName.Full(), and ProductName.Marketing(), each one should be used according to the context of your message.

Dynamics 365 Business Central 2020 release wave 2:
ProductName.Short(): Business Central
ProductName.Full(): Dynamics 365 Business Central
ProductName.Marketing(): Microsoft Dynamics 365 Business Central

Test:

pageextension 50100 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage();
    var
        ProdcutionNameTxt: Label 'The full production name is ''%1''.\The short production name is ''%2''.\The Marketing production name is ''%3''.';
    begin
        Message(ProdcutionNameTxt, ProductName.Full(), ProductName.Short(), ProductName.Marketing());
    end;
}

MS DOCS:
ProductName Data Type

Hope this will help.

Thanks.

コメント

Copied title and URL