Wednesday, December 14, 2016

Lookup is slow in Microsoft Dynamic CRM.

Problem Statement :

Lookup is unresponsive and painfully slow in Dynamic CRM.

Objective :

To identify the cause which is making Location lookup to be unresponsive.

Lookup in Dynamic CRM

A lookup represent parent child relationship between two entities.
For an example :
An Account (Organization) can have many contacts associated.
CRM by default have 1-Many relationship between account and a contact.


What SQL Index has to do with Lookup

Purpose of Indexes is to fine tune search operation in a table/entity.
In Dynamic CRM each table/entity have a Primary key which becomes a unique clustered index.
One table can have only one Unique-Clustered Index and can have Many Non-Unique-clustered indexes.

If overall Dynamic CRM is suffering from a performance issues, one may think of Re-building Non-Unique Clustered Indexes.
  • It is recommended to schedule a job which takes care of Re-building indexes from time to time.
  • Re-building of indexes may involve extremely high usage of memory, CPU and other resources so it should be done mostly during non-working hours, to avoid impacting business operation.


One should be able to analyse and see if overall CRM performance is at stake or there are few Lookup’s which may causing a performance problem and need to be taken care off.

Now, let see how internally Lookup types get represented  in SQL.
Diagram is from On-Premise solution but it would be same for On-Line CRM.





















A Primary Key is a 32 Bit Guid represented in format like this (E5E154C1-62D0-E311-940C-005056946CA6).

A Lookup which is a primary key from related entities is a same represented in Guid format along with its Primary name (string) attribute, as we can see in diagram.
  • ParentCustomerId                 - Lookup Guid Column
  • ParentCustomerIdName         - Lookup Name (string)

How can we create Indexes in Dynamic CRM

For On-premises deployments of Dynamics CRM we can add SQL indexes as needed directly in SQL.

For CRM Online we are required to open a support ticket and make the request to Microsoft Support.

(We have to do a homework and be sure that the index will solve the issue and not leave database performance unaffected or, worse, slow down your CRM)


Enabling Quick Find Record Limits to “YES”

Navigate to Settings -> Administration -> System Setting page.


















Understanding Quick Find in Dynamic CRM

Quick Find allows you to search for a record from a grid view.









Every entity have Quick Find Active view and can be configure from customization page.












When you open the configuration page of Quick Find Active view, we get an option to “Add Find Columns”.























We can tick on attributes which we think are beneficial for a quick search.



























Don’t forget to save and Publish your changes.



How to create a custom Lookup control used in web resource in Microsoft Dynamic CRM (MS CRM)?

Thanks.
Vipin Jaiswal
vipinjaiswal12@gmail.com


Thursday, October 6, 2016

Hide a Dashboard in Microsoft Dynamics CRM 2016


Microsoft Dynamic CRM 2016 comes with list default system dashboards. In many cases organization/ clients may not need such a long list of system dashboards appearing on UI.

Default System Dashboard’s should not be deleted from Dynamic CRM. 
If we delete them, there are chances that we may encounter further issues when we try to import any managed solution that reference a deleted dashboard and import will fail as it’s is expecting them.

Now there are two scenario which we need to understand    
1)    Hide a specific dashboard for all users.
2)    Hide a specific dashboards for only few or specific users. 

The best practise says to use security roles to hide them from Crm users.
The steps to hide a system dashboard from any Crm users is

     1)    Open dashboard from default solution from Settings -> Customizations -> Customize the System -> Dashboards   
   






    
















2)    Click on Enable Security Roles and change radio button from Display to everyone to Display only to selected security roles.

      3)    Unchecked all security role.






















This way we can hide specific dashboard from the UI.


Hiding specific dashboards for only few or specific users.

Hiding dashboards from specific user from a security role is not suggested.

We can understand why it’s not suggested by thinking of a situation where users may have same security role and we need to hide dashboards among few of them.

In this scenario we need to create a personal dashboard and then share it with specific users/teams.

Steps to make dashboard visible to specific list of users.

     1)    Create a personal dashboard by clicking NEW on dashboard home page.


















     




















2) Select a template accordingly which best suits your requirements.


 3)    Finalize dashboard by configuring various components on dashboards accordingly. 
          Save and close the dashboard.
    4)    Open your dashboard and you would be available with SHARE DASHBOARD option.



    
  5)    Open Share user dashboard and Choose the users or team you want to share the user dashboard with, 
       and give them specific permissions.





That’s it, only user with given permission would then be allowed to make a use of dashboard.


Happy CRM Learning.



Tuesday, September 27, 2016

Trying to update an attribute in Live, which is not allowed : Microsoft Dynamic CRM 2016



Invalid Operation: Trying to update an attribute in Live, which is not allowed

Exception Messages

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Invalid Operation: Trying to update an attribute in Live, which is not allowedDetail:


How and When Problem Occurs

First of all, I am going to make a note that it’s NOT a bug in Microsoft Dynamic CRM.

The exception message flashes when by any mean we try to update any out of the box report in Microsoft Dynamic CRM online.

The reason being Dynamic CRM online does not permit or allow to have an access to SQL Server. All out of the box reports cannot be edited and updated back to dynamic CRM online.

The problem may occurs due to

  • When we try to import a solution, which has any out of the box report.
  • When we try to overwrite any out of the box report, directly from Report edit wizards.


Things to note

Microsoft Dynamic CRM Online only support SSRS (.rdl) with Data source created using fetch data provider. So, in visual studio when selecting report project, we need to select type in data source as


























If you are not getting Microsoft Dynamic CRM Fetch option then you need to install Microsoft Dynamics CRM Report Authoring Extension (with SQL Server Data Tools support).

Download here

Things to know about MS CRM default reports

  • There are 25 out of the box reports which come default with vanilla CRM in an online Microsoft Dynamic CRM 2016 version.
  • There are sub reports also which are part of these report.
  • An example of a Report and a sub report is Campaign Performance. We can list all report by changing the view.









Monday, September 26, 2016

How to hide a section in MS CRM 2016 based on user logged in ?

Today I am blogging about how can we hide a section in MS CRM 2016 using JavaScript.

Where might this functionality be required ?
  • Based on user logged-in, we may not want user to see all details.
  • Based on some selection of check box or some field value, we may require to hide a section altogether.


I have created some Generic Method to Hide and Show Tab and Section

Please refer here : 

https://vjcity.blogspot.com/2021/07/generic-method-to-hide-and-show-tab-and.html

 

 


Understanding MS CRM Page different controls and Hierarchy


The MS CRM Page object is available in forms by referencing Xrm.Page
The Page Object is having two important part.

  • Xrm.Page.data provides methods to work with the form. You can refresh the data in the form and save the form asynchronously.
  • Xrm.Page.ui contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form.

Guidelines to write good JavaScript code in Microsoft Dynamic CRM

https://vjcity.blogspot.com/2019/08/guidelines-to-write-good-javascript.html


Few of the ui components are :

Xrm.Page.ui.quickForms
A quick view control is a quick view form added to a main form in Microsoft Dynamics CRM that enables you to view information about a related entity record within the main form.

Xrm.Page.ui.tabs         
A tab is a group of sections on a page.

Xrm.Page.ui.process
It provides methods to interact with the business process flow control in a form.

Xrm.Page.ui.navigation
It have items represents one of the available options available in  the navigation bar of an entity.

Xrm.Page.ui.tabs.get("tab_name").sections
A section partition various items of the form within a specific tab. It can be called as a container of all  fields or an attribute of an entity.

For more details about ui component of Microsoft Dynamic CRM, you can refer to MSDN article here
Code to hide a section for a given bunch of CRM users ?


// Obtain the User Id from context of the page.
var userId = window.parent.Xrm.Page.context.getUserId();

// Check for user Id match
if (userId == "{3220927E-0205-DD11-93BA-0018FE304530}"     // User – Vipin Jaiswal
   || userId == "{C6928F30-8B5A-E611-80EE-00155DCFC14C}"   // User – Heena Gupta
   || userId == "{74EFA877-0205-DD11-93BA-0018FE304530}"   // User – Pradnya Apte
   || userId == "{5744B501-74F2-E311-BFDF-000C295A41AA}"   // User – Mohan Sony
   )
{           
// Use setVisible(true) to DISPLAY section
Xrm.Page.ui.tabs.get("tab_name").sections.get("section_name").setVisible(true);
}
else
{
// Use setVisible(false) to HIDE section
Xrm.Page.ui.tabs.get("tab_name").sections.get("section_name").setVisible(false);
}


Note :
How to obtain Guid of User

Just open a CRM User record in the new tab of the browser and from the URL take out the guid.

An Example

etc=8&extraqs=&histKey=68878144&id=%7b3220927E-0205-DD11-93BA-0018FE304530%7d
&newWindow=true&pagetype=entityrecord&sitemappath=Settings%7cSystem_Setting%7cnav_security

Within %7b ---  and %7d in URL, unique guid is referred internally for CRM reference.


How to obtain section and tab name used in code above

Open the form in edit mode and select any tab or section and click on its properties.