View Designer plugin in XrmToolBox

In one of my previous post I explained how to apply “OR” condition for the filters that are split between the two entities, however, these type of conditions were not possible to apply for views in MS CRM. But, now we have a new plugin called “ViewDesigner” introduced in our favorite XrmToolBox where you can apply whatever filter you want to the existing views in CRM.  Here is the link to know full advantages and usage of this plugin.

Hope it makes easier the developer effort !!!

Limitations of Business Rule with Mobile App

One of our customer reported that couple of Business Rules are not working in Mobile app which are working perfectly in Web application. Spent so much time to understand the problem with Mobile app and finally figured out that one tab on the contact form is not loaded in mobile app because of maximum 5 tabs allowed limitations. Some fields that we are referring in theĀ  business rules are part of this missing tab. So, business rule trying to lock (unlock, mandatory, setvalue etc.,) the field which is not loaded on the form and failing. Finally we decided to create a new form by considering the limitations with mobile app and the business rules that we implemented.

Below are the limitations of Forms in mobile app

  • You shouldn’t have more than 75 fields on the Form
  • You shouldn’t have more than 5 tabs on the Form
  • You shouldn’t have more than 10 sub grids on the From

I think the above numbers we can adjust with some settings but these are defined by Microsoft for optimal performance. The components that are exceeding the above numbers will not be shown on mobile app.

Hope it helps !!!

Restrict contact deletion on account delete

As per the OOB functionality all the child records of account like contacts, opportunities and activities etc., will be deleted on delete of account. But, in one of my project we got a requirement to remove the link with contacts instead of delete. I tried to customize the relationship but the CRM is not allowing us to do this.


Finally we ended up with writing the plugin to achieve this. We have to write this plugin on “Pre Validation” stage of “Delete” step on Account entity. The child records were not available in any other steps (Pre Operation for ex) as the CRM platform deletes all the child records first and then account. The following is the plugin code.

IPluginExecutionContext pluginContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService organizationService = serviceFactory.CreateOrganizationService(pluginContext.UserId);
EntityReference targetEntity = (EntityReference)pluginContext.InputParameters["Target"];

QueryExpression getContacts = new QueryExpression("contact");
getContacts.Criteria.AddCondition(new ConditionExpression("parentcustomerid", ConditionOperator.Equal, targetEntity.Id));
EntityCollection allContacts = organizationService.RetrieveMultiple(getContacts);
foreach(Entity contact in allContacts.Entities)
Entity contactToBeUpdated = new Entity("contact");
contactToBeUpdated.Id = contact.Id;
contactToBeUpdated.Attributes["parentcustomerid"] = null;

Happy coding !!!