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.

apps

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!

Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.