שתף באמצעות


GetEnvironment Method

Gets information about the environment that the control add-in is using.

Method Signature

object Microsoft.Dynamics.NAV.GetEnvironment()

Return Value

Returns an object that contains the following members:

Member Description
UserName Type: String

The name of the user that is logged into the Microsoft Dynamics NAV Server.
CompanyName Type: String

The name of the company that the current user is using on the Microsoft Dynamics NAV Server.
DeviceCategory Type: Integer

An integer indicating the type of device that the control add-in is being rendered on. Possible values:

0 – Desktop client, either Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Web client.

1 – Microsoft Dynamics NAV Tablet client.

2 – Microsoft Dynamics NAV Phone client.
Busy Type: Boolean

A boolean indicating whether the client is currently busy. The client could, for example, be busy performing an asynchronous call to the server.
OnBusyChanged Type: Function

A function that is called when the Busy state of the client has changed.

Function Syntax

The syntax of the function is the following:

function callback()
Platform Type: Integer

An integer indicating the underlying platform that the control add-in is being rendered on. Possible values:

0 – Microsoft Dynamics NAV Windows client.

1 – Microsoft Dynamics NAV Web client, Microsoft Dynamics NAV Tablet client, or Microsoft Dynamics NAV Phone client in a browser.

2 – Microsoft Dynamics NAV Universal App.

3 - Microsoft Office add-in.
UserInteractionMode Type: Integer

An integer indicating the user interaction mode that the control add-in is being rendered under. Possible values:

0 - Mouse

1 - Touch

Example

This code example illustrates how you can assign members of the object return type to variables and use the Busy member to determine whether the client is busy or not.

var environment = Microsoft.Dynamics.NAV.GetEnvironment();  
  
var userName = environment.UserName;  
var companyName = environment.CompanyName;  
  
environment.OnBusyChanged = function()   
{  
    if (environment.Busy) {  
        // The client is now busy.  
    }  
    else {  
        // The client is not busy anymore.  
    }   
}  
  

See Also

Extending Any Microsoft Dynamics NAV Client Using Control Add-ins
InvokeExtensibilityMethod Method
GetImageResource Method
Asynchronous Considerations