Wednesday 4 April 2018

Dynamics CRM: Sorting of related column in view


In Dynamics CRM sometimes we need to change sorting of a view. We can use main entity columns to configure sorting. But Out-of-box Dynamics CRM not allows to use column of lookup entity.


Example: - 
We need to sort the “Active Account” view based on Primary contact email.
Issue: - If we go to the view of “Active Account” and try to configure sorting we will see only column of Account entity. Even we have added email address of primary contact in our view.



View: -










Sorting: -





Here we can’t see Email address of contact entity to configure sorting.
Solution: -  
  •   Create a Solution.

            Go to setting-> Solution -> New solution
Name the solution and publisher and version.













  
  • Add “Active Account” view in solution

Click on Entity from solution component.
     Click on “Add Existing” Button and select account entity and press OK.
  • Now select “Active Account” view and click on Finish.

Do not include “Add All Assets”.

  • Now export the solution.

Click on Export solution button.

  • Open customizations.xml file in notepad or visual studio.

  • Go to fetch node and add email in order


<order attribute="emailaddress1" />
Remove other working order from fetchxml
<order attribute="name" descending="false" />


You can also use fetch builder to add/remove order.

  • Go to layoutxml node in your file and Remove disableSorting="1" from email cell.

Save the changes in customization.xml file.
  • Re-import the solution in your organization. And publish all customization.
  • Refresh your browser (press f5) or relogging. And go to “Active Account” view.
  • Now you will see sorting is activated on contact’s Email column.

You can also use “View Designer” plugin of Xrmtoolbox to make these changes.





















No comments:

Post a Comment

Field Security Profile - Based on Owner

 Recently received requirement related to Field security profile. Expectation : - 1.       Set to users need access of secure attributes. 2....

Test