Showing posts with label System View. Show all posts
Showing posts with label System View. Show all posts

Tuesday, March 24, 2015

Show Parent and child together..MS CRM view sorting without column in view

MS CRM allows view to be sorted by columns which are in view only.. but some time we don't want to show column in view but want to sort view by that column.


I have a situation in contact view.. I have contacts who has child contact records and in view I want to show parent and child contact records together.




For this I added one column in contact entity - Contact number (text), and I am numbering contacts are like
1. Parent - 01
   Child 1 - 011, child 2 - 012
2. Parent 02
   Child 1 - 021, child 2 - 022, Child 3 - 023

I added this contact number column in my view and then able to sort as per requirement.



But customer don't want to see the contact number column in grid, but wants the same sorting..

To achieve this I exported contact entity customization. and looked into Saved query for this view.
Saved query has layout xml and fetchxml.

First I removed Contact number column from layout xml.

<layoutxml >
  <grid name="resultset" object="2" jump="fullname" select="1" icon="1" preview="1">
    <row name="result" id="contactid">
      <cell name="new_contactnumber" width="300" / >
      <cell name="fullname" width="300" / >
      <cell name="emailaddress1" width="150" / >
      <cell name="parentcustomerid" width="150" / >
      <cell name="telephone1" width="125" / >
    </row>
  </ grid>

</ layoutxml>

Then I looked at fetch xml, it has order node..

<fetchxml>
  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="contact">
      <attribute name="fullname" / >
      <attribute name="parentcustomerid" / >
      <attribute name="telephone1" / >
      <attribute name="emailaddress1" / >
      <order attribute="fullname" descending="false" / >
      <filter type="and">
        <condition attribute="ownerid" operator="eq-userid" / >
        <condition attribute="statecode" operator="eq" value="0" / >
        <condition attribute="createdon" operator="today" / >
      </filter>
      <attribute name="new_contactnumber" / >
      <attribute name="contactid" / >
    </entity>
  </ fetch>

</ fetchxml>

I changed this order node as

      <order attribute=" new_contactnumber " descending="false" / >

Saved customization and imported back to CRM.. and Published customization..
Now my view is  showing same sorting and no contact number column in it..




Friday, January 30, 2015

Change Display order of system views

In CRM system views are order by number and alphabets. When view name is starting with number, that view was shown first and then views shown by alphabet orders. 


If want some custom order then we need to modify view name and either add number or alphabets in front of view name 

1.       Go to customization of entity views.

2.       Open view and click on view properties. 
1.       Add either number or alphabet in Front of view name


1.       Save view and change name of other views as per order


1.       Publish customization



with Alphabet order 







Wednesday, January 21, 2015

View Sorting more than two columns

In CRM when creating view, CRM UI is allowing to sort view by only two columns.



User can sort views by multiple columns when it views opens and by using [SHIFT + click] on multiple columns.



 When we want to sort view by multiple columns when it opens, then need to export customization and need to made changes in customization xml.

Step 1:  Export customization of entity whose view want to sort by more than two columns.
Step 2: Extract and open customization.xml file in Visual studio or XML editor.
Step 3: In the Customization.xml look for Savedquery section for your entity.
Step 4: Find Savedquery of view which you want to sort by more than two columns.
  Saved Query has LocalizedName tag which gives view name.  
Step 5: To sort by more column we need to modify fetchxml of saved query.
General saved query fetch xml will be like

<fetchxml>
              <fetch version="1.0" mapping="logical">
                <entity name="edm_test">
                  <attribute name="edm_name" />
                  <attribute name="createdon" />
                  <order attribute="edm_name" descending="false" />
                  <order attribute="new_age" descending="false" />
                  <filter type="and">
                    <condition attribute="statecode" operator="eq" value="0" />
                  </filter>
                  <attribute name="new_phone" />
                  <attribute name="new_email" />
                  <attribute name="new_date" />
                  <attribute name="new_age" />
                  <attribute name="edm_testid" />
                </entity>
              </fetch>
         </fetchxml>

To sort by more columns add order tag as
             


Final fetchxml will be
<fetchxml>
              <fetch version="1.0" mapping="logical">
                <entity name="edm_test">
                  <attribute name="edm_name" />
                  <attribute name="createdon" />
                  <order attribute="edm_name" descending="false" />
                  <order attribute="new_age" descending="false" />
    <order attribute="new_phone" descending="false" />
                  <filter type="and">
                    <condition attribute="statecode" operator="eq" value="0" />
                  </filter>
                  <attribute name="new_phone" />
                  <attribute name="new_email" />
                  <attribute name="new_date" />
                  <attribute name="new_age" />
                  <attribute name="edm_testid" />
                </entity>
              </fetch>
         </fetchxml>

Step 6: Save customization.xml file, import and publish.