Showing posts with label MoCA tips. Show all posts
Showing posts with label MoCA tips. Show all posts

Friday, 9 June 2017

Mobile compatible development - disable all fields using JS - Microsoft Dynamics CRM - MoCA_Tip#3


Hello All,

Lets go though a quick tip on best practice around disabling all fields using JavaScript in MoCA.

Issue:
In traditional CRM JS development, we tend to use  getDisabled function to identify whether a control is disabled or not and setDisabled to enable or disable a field.

But in MoCA there are some controls which do not expose the above functions which result in JS error(not defined or not found).

Fix:
Before calling the function validate whether the function exist or not  and then call the same. By this way we can avoid unnecessary chaos in our JS.

Code Snippet:

if (control && control.getDisabled && !control.getDisabled()) {
   control.setDisabled(true);
}


Refer this blog for MoCA compatible disable all fields script

Don't forget to go through previous tips if you have missed,
  1. Form Selector and its usage

Monday, 29 May 2017

Mobile compatible development - formSelector - Microsoft Dynamics CRM - MoCA_Tip#2

After the MoCA wave with D365, we are rapidly evolving in mobile space. This evolution demands mobile compatible development and the same is our key to success.

I have planned to share my experience with MoCA as a series and the link for previous tips can be found at the end of this blog.

lets jump on to the tip now,

Its common to have Xrm.Page.ui.formSelector in our JavaScript development and the same is used to identify current form and for form navigation.

Xrm.Page.ui.formSelector is not supported in mobile!
In MoCA formselector is not available and usage of the same will result in form error. This is because mobile application doesn't have multiple forms. 

From MSDN Library:
Dynamics 365 for phones and tablets does not provide the capability to switch between forms. If you have more than one main form for an entity, the one displayed depends on the form order set and which security roles are assigned to the form.


Ways to overcome this issue,
  1. Preferred solution is to avoid using multiple forms 😉  - This may sound crazy, but its better to design the main form in a way that everything fits into it. This automatically streamlines all your form related development mobile compatible. 
  2. Another way is to conditionally avoid form selector piece of code by validating the client. If the client is mobile skip the specific portion of code, sample code snippet is as follows

if (Xrm.Page.context.client.getClient() != "Mobile")
{
    //Form selector code goes here

}


Don't forget to go through previous tips if you have missed,
  1. Document template Fix
  2. Hidden tabs and Mobile application organization settings

Happy learning!



Tuesday, 4 April 2017

Mobile compatible development - Microsoft Dynamics CRM - MoCA_Tip#1


After the release MoCA, I was interested in exploring the functionalities available and I am happy with the available features.

Now, we are going to see some tips based on my previous experience with MoCA. I will try to provide some more tips in upcoming blog posts,

Behavior of hidden tabs
  • ·        CRM web forms ignore hidden tabs when they are loaded in Mobile. Therefore, if you have any logic based on hidden section fields then those logics are going to break.
  • ·        Make sure the tab is visible on form. Then hide the same using JavaScript, this will make the tab and fields available on form.


Error with field's customized event – Random errors on specific forms
  • ·        This error is common on the forms, which contains multiple tabs/sections/fields, and the errors are random and not specific to any functionality.
  • ·        This is because, we have limits on the count of controls available on mobile form and these are configurable in orgsettings


The default and max allowed items for a mobile form is as follows,

Setting
Default Value
Max Value
TabletClientMaxFields
75
500
TabletClientMaxLists
10
50
TabletClientMaxTabs
5
50

Sunday, 26 March 2017

Microsoft Dynamics 365 Mobile(MoCA) - Metadata Error(Metadata corrupted - Error_Message_Generic_Mobile_Client ErrorDialog.ProvideTechnicalDetails)

Hello All,

Lets go through a quick fix for a type of Metadata Error in Microsoft Dynamics Mobile Application (MoCA). 

In one of our recent projects, we faced a metadata error in MoCA application out of no where. After spending hours around this issue and with the timely support of MS team, we were able to find the root cause and fix,

Issue Summary is as follows,

Issue: While opening mobile app, the app crashes with an error Error_Message_Generic_Mobile_Client ErrorDialog.ProvideTechnicalDetails
Analysis:



This error can be caused because of multiple reasons, In our case we used logs and browser's developer tool errors to identify the issue is around MSCRM Document templates.


This occurs whenever you delete an entity from CRM and it has an associated document template. When MoCA builds metadata, it was trying to retrieve a document template of a deleted entity that results in a null reference error.

Solution:
Identify the document template related to the deleted entity and remove the same from the system.

Hope this helps!