Having recently created a custom app that integrates with Dynamics CRM, I came across a few issues that took me a while to resolve. This post I’m sharing some of the workarounds I have for those issues.
When working with the mobile SDK, one of the things you’ll find is that almost everything happens asynchronously. This means all SDK calls take time to come back, and leave the app open to interaction from the user within this period of time that may lead to unintended behaviour – opening multiple Navigation pages, instantiating multiple instances of an object, creating duplicates of an object in CRM, or just throwing errors (null or otherwise), left right and centre.
When integrating your app with CRM, it’s important to note that the plugins on your target system will still run on the messages created by the calls from your mobile application. This means that performing any action that would cause the web interface to throw an error in the app will have the same result. This is often in the form of an OrganizationServiceFault. It’s important to catch these and deal with them appropriately, be it in the form of informing the user and cancelling the operation, or throwing an in-app error. Not handling these exceptions properly can cause the app to crash.
This is because the plugins act against the SDK messages, and your app uses the same SDK messages as the web interface. This means that you should expect to see the same behaviour from triggered events as well.
Data doesn’t always seem too big, but when dealing with several tens of thousands to hundreds of thousands of records, data can come at a big cost, particularly if you want to cache the data for offline use. Consider caching only required data, and for the rest simply downloading and using as needed. If your app involves retrieving all entities of a specific type, consider setting a record limit for a single view, with option to load more if required. This can greatly reduce the amount of data that is required to be stored on the device. However, if the target application has a small data set, this may not be a concern for you.