Tuesday, January 27, 2015

MS CRM Chart - Axis labels sorting by month



In above chart, all month are not shown in correct order.
To correct the order / sort those labels, we need to export chart XML.
In Chart XML, need to look for FetchCollection
<fetchcollection>
  <fetch mapping="logical" aggregate="true">
    <entity name="new_test">
      <attribute groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" dategrouping="month" name="new_date" />
      <attribute alias="_CRMAutoGen_aggregate_column_Num_0" name="new_phone" aggregate="count" />
    </entity>
  </fetch>
</fetchcollection>

Update this fetchXML with 


<fetchcollection>
  <fetch mapping="logical" aggregate="true">
    <entity name="new_test">
      <attribute groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" dategrouping="month" name="new_date" />
      <attribute alias="_CRMAutoGen_aggregate_column_Num_0" name="new_phone" aggregate="count" />
      <order alias="_CRMAutoGen_groupby_column_Num_0" descending="false"/>
    </entity>
  </fetch>
</fetchcollection>

Notice that I used alias of my Date attribute for order. 

Save your XML and reimport to CRM, publish and done..
Now your chart will be look like 


Either one is required on form..

Sometimes we need either phone or email is required to be filled. 
To do this mostly we will write JavaScript, but we can do this by using CRM business rules also.. 

You need do this by adding three different business rules on Phone and Email attribute. 
Here are these business rules
1. When user opens form, on form either you can show message that Phone or Email required and set Business requirement level. 



2.  If email entered, then remove Business requirement from Phone.

3. When Phone entered email is not required. 

Done, save your business rule.. publish.. 



Resolve Circular Reference in CRM data import

Generally when importing data into CRM.. most of the time we will struggle when there is a circular reference between entities.

Suppose if we want to import Account (Company) and contact information into CRM. and want to update company's primary contact which is in contact and Contact's company information which is in Account.

In this case easiest way to import and update circular reference is import both entities data together as zip.

Compress contact.csv and account.csv file into one .zip file, and then using CRM Data Import import zip file.
CRM is supporting for .zip, xml, text and csv file.

Once you uploaded zip file in import wizard, you can select individual file and create mapping for
each file





Map your fields properly and import.. 

You can load only 8 MB of file (xml, csv, text) or 32 mb of zip file for data import.