Compartir a través de


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.

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()

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

Reference

InvokeExtensibilityMethod Method
GetImageResource Method

Concepts

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