Home
> Dynamics 365 > Dynamics 365 Mobile Client – Script to get Longitude and Latitude and pin to Maps
Dynamics 365 Mobile Client – Script to get Longitude and Latitude and pin to Maps
With the new Dynamics 365 Mobile client, we got a new API Xrm.Utility.getCurrentPosition which returns the current location coordinates.
This API only works with Mobile Client and referring this in Web Application would cause script error.
Pre-requisite:
We need to Enable User Location setting on the device
- Go to Settings -> Device Integration Settings
- Enable “User Content and Location”
Script to get coordinates:
function onload() {
var isCrmForMobile = (Xrm.Page.context.client.getClient() == “Mobile”);if (isCrmForMobile) {
Xrm.Utility.getCurrentPosition().then
(function (location) {
Xrm.Utility.alertDialog(“Latitude: ” + location.coords.latitude +
“, Longitude: ” + location.coords.longitude);
},
function (error) {
Xrm.Utility.alertDialog(error.message);
})
}
}
HTML File to Read Coordinates and Show in Map
🙂
Categories: Dynamics 365
Dynamics 365, Maps, Mobile Client Coordinates
Hi Rajeev,
How to get auto generated number sequence for a Expense ID in power app.
Steps followed :
1. in D365 created a custom data entity , using table TRVexepnse.
2. Logged to Power app, created a app using data connection as Dynamics 365 for operations and selected the custom data entity.
3. I got 3 screen in the app, browse, detailed and edit screens.
4. While adding new record through app, Expense ID should generate automatically. (App showing error saying Expene no is mandatory)
5. In APP, Expense field is read only.
Please suggest how to over come this issue.
Regards,
Gayatri
But HTML doesn’t works on Phone..An above doesn’t works on web…So basically We can only use it for tablet or is there any way to view it either on web or mobile?