Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Adrian Begovich's Blog / Xrm.Device Client API Methods

Xrm.Device Client API Methods

Adrian Begovich Profile Picture Adrian Begovich 1,014 Super User 2024 Season 2

The Xrm.Device Client API namespace is included in Microsoft Dynamics 365, version 9.0 as part of the Xrm Object Model. It provides six methods for utilising native device capabilities of mobile devices. This blog post aims to explain how the Xrm.Device Client API methods work and demonstrate practical uses for them. If you have other creative uses for these methods, then post them in the blog comments.

Xrm.png
captureAudio
Records audio with the device microphone, and returns a base64 encoded audio object on success. This is a useful method for recording and storing audio from a device.

Xrm.Device.captureAudio().then(successCallback, errorCallback)

captureImage
Captures an image using the device camera, and returns a base64 encoded image on success. This can be used to scan the pictures of contacts or logos, and store the pictures in your Dynamics 365 system.

Xrm.Device.captureImage(imageOptions).then(successCallback, errorCallback)

captureVideo
Records video with the device camera, and returns a base64 encoded Video object on success. This is a useful method for recording video content from a device.

Xrm.Device.captureVideo().then(successCallback, errorCallback)

getBarcodeValue
Scans barcode information with the device camera, and returns a string containing the scanned barcode value on success. This is a great way to store barcode values in your Dynamics 365 system.

Xrm.Device.getBarcodeValue().then(successCallback, errorCallback)

getCurrentPosition
Returns the devices current location using geolocation, if it is enabled on a mobile device. This method returns latitude and longitude values as well as a set of other optional attributes such as altitude and speed.

Xrm.Device.getCurrentPosition().then(successCallback, errorCallback)

pickFile
Opens a dialog box to select files from a web client or mobile clients, and returns an array of objects on success. This method can be used to select an audio, video, or image file and attach it to a Dynamics 365 record.

Xrm.Device.pickFile(pickFileOptions).then(successCallback, errorCallback)

Comments

*This post is locked for comments