apps

JavaScript is a great tool for adding functionality into Microsoft Dynamics 365 and many users commonly use it. However, while JavaScript works great within browsers, when utilizing the Dynamics 365 apps for mobile, certain JavaScript code may cause errors within the application.

While one option may be to review the code to resolve errors, there may be circumstances where the code is simply not compatible or is not required in the mobile app. In this situation, you can add a small line of code to a JavaScript function to disable the code from running on mobile.

Simply add this ‘if statement’ into a function to stop it from running:

if (Xrm.Page.context.client.getClient() != “Mobile”)

Now the function will run if the code does not equal mobile.

Consider using business rules or calculated fields where possible to replace erroneous JavaScript functionality that will work on mobile devices.

Hope that helps resolve any errors you come across. For more Dynamics 365 how to guides and tips – make sure you subscribe to our blog!

Happy Dynamics 365’ing!