Dynamics 365 Business Central: How to get the client type that is running in the current session via AL code

Dynamics 365 Business Central

Hi, Readers.
This week, I found an interesting question on Twitter. Although it already had an answer. I’d like to talk a little more about the details.
Question:

So in this post, we will discuss how to get the client type that is running in the current session via AL code.

First let’s take a look at Client Type in Business Central.
ClientType Option Type: Represents the type of the client executing the operation.

Memebers:

MemberDescription
BackgroundA background session.
ChildSessionA child session.
DesktopA desktop client.
ManagementA management client.
NASA NAS client.
ODataA NAS client.
PhoneMicrosoft Dynamics Business Central Phone client.
SOAPA SOAP client.
TabletMicrosoft Dynamics Business Central Tablet client.
WebMicrosoft Dynamics Business Central Web client.
WindowsMicrosoft Dynamics Business Central Windows client.
CurrentMicrosoft Dynamics Business Central Windows client.
DefaultThe default client.
ODataV4A ODataV4 client.
ApiAn API client.
TeamsMicrosoft Teams client.

Then, there is a method.
Session.CurrentClientType Method: Gets the client type that is running in current session.

For example: Show the client type when open Item list page.

Browser:

Phone:

Teams:

Business Central Windows 10 desktop app:

So what can we do more with client type?
Similar to the question at the beginning, we can use this function to specify each client type’s program separately.
For example: Item Description can only be modified in the web client.

If you modify it in other client types, an error will be reported.

Edit in Excel

Test Video:

END

Hope this will help.

Thanks for reading.

ZHU

コメント

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