Thursday, January 29, 2015

Long label trimming on Form


To show full label on form there are two option.. Supported way.. and unsupported way.. 

Supported option:
You can show complete label on CRM form by using HTML web resource. You need to create HTML web resource and add that web resource as label for attribute. 
And in the HTML web resource add complete label. 
For your attribute whose label is too big.. don't show label on the form by changing field property.


Add Two column section on form and add this field into section. 
Add new HTML web resource to form in above section and set web resources properties as 



Add your label text inside html web resource.. save and publish your form. 
then label will be shown as 


Unsupported option:
Go to CRM server where your CRM web application installed. 
CRMWeb\_common\styles\fonts.css.aspx
Open above file in text editor
 Add CSS element into this file.
  1. .ms-crm-InlineEditLabel { white-space: normal !important; }
Save file.. Do iis reset and check your CRM form. 


There are advantages and disadvantages of both options.. 
If you are doing by supported way then for each long label attribute you need to create and add new html web resource on form. but if you are doing by unsupported way you don't need to create html web resource. 
Main problem with unsupported is that when you install any roll ups you need to make these change in file..  

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..