getGlobalContext.client (Client API reference)
Provides access to the methods to determine which client is being used, whether the client is connected to the server, and what kind of device is being used.
var clientContext = Xrm.Utility.getGlobalContext().client
The following methods are available for the client context.
getClient
Returns a value to indicate which client the script is executing in.
Syntax
clientContext.getClient()
Return Value
Type: String
Description: The values returned are:
Value | Client |
---|---|
Web | Web application |
Web | Unified Interface |
Outlook | Dynamics 365 for Outlook client (COM add-in) |
Mobile | Mobile app |
getClientState
Returns a value to indicate the state of the client. Note that a client in offline-first mode (in preview) will always indicate it is offline.
Syntax
clientContext.getClientState()
Return Value
Type: String
Description: The values returned are:
Value | Client |
---|---|
Online | Web application, Dynamics 365 for Outlook client (COM add-in), Mobile app, Unified Interface |
Offline | Outlook, Mobile app |
getFormFactor
Returns information about the kind of device the user is using.
Syntax
clientContext.getFormFactor()
Return Value
Type: Number
Description: The values returned are:
Value | Form Factor |
---|---|
0 | Unknown |
1 | Desktop |
2 | Tablet |
3 | Phone |
isOffline
Returns information whether the client state is online or offline. Note that a client in offline-first mode will always report it is offline.
Syntax
clientContext.isOffline()
Return Value
Type: Boolean
Description: true if the server is offline; false otherwise.
isNetworkAvailable
Returns information whether the network is available or not, regardless of client mode.
Syntax
clientContext.isNetworkAvailable()
Return Value
Type: Boolean
Description: true if the network is available; false otherwise.
Related topics
Feedback
Submit and view feedback for