Translate

Thursday, 6 June 2013

How to filter view on dashboard with html web resource.

CRM-2011 How to filter view on dashboard ?

CRM-2011 How to filter view without date time attribute ?    

CRM-2011 How to filter view with HTML web resource ?   

CRM-2011 How to update fetch of a view ?   

CRM-2011 How to filter view on dashboard with HTML web resource ? 


Here you can get the answer of above questions regarding CRM 2011.


If you want to filter a view on the dashboard with date time and you do not have date time attribute and option set of for month and year in your entity then don’t worry you are on right place. I will provide you code and steps by which you can filter view with date time without having date time field in entity related to view. 

Step 1: First of all add a HTML web resource in your crm solution. And write the fallowing code in the                 web resource.


<html>
     <head>
          <title> </title>
               <script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>
               <script type="text/javascript">
                       function submitForm() {
                            var form = document.forms[0];
                            var context = GetGlobalContext();
                            form.action = context.getServerUrl() + '/AdvancedFind/fetchData.aspx';                           
                            form.LayoutXml.value = '<grid name="resultset" object="10172" jump="atr_name" select="1" icon="1" preview="1"></grid>';
                            form.FetchXml.value = "<fetch version='1.0' mapping='logical'><entity name='Entity Schema Name'><attribute name='atr_xyz' /><attribute name='atr_name' /><attribute name='createdon' /><order attribute='atr_name' descending='false' /><filter type='and'><condition  attribute='atr_year' operator='eq' value='" + new Date().getFullYear() + "' /><condition attribute='atr_systemuserid' operator='eq-userid' /></filter></entity></fetch>";
                            form.submit();
                         }
                </script>
           <meta charset="utf-8">
      </head>
    <body onload="submitForm()">
        <form method="post" action="">
           <input name="FetchXml" type="hidden">
           <input name="LayoutXml" type="hidden">
           <input name="EntityName" value="entity svhema name" type="hidden">
           <input name="DefaultAdvFindViewId" value="32 Bit View Id" type="hidden">
           <input name="ViewId" value="00000000-0000-0000-00AA-000010001004" type="hidden">
           <input name="ViewType" value="10172" type="hidden">
           <input name="SortCol" value="atr_name" type="hidden" ;="">
           <input name="UIProvider" type="hidden">
           <input name="DataProvider" type="hidden">
       </form>
    </body>
</html>

Step 2: Create or Open dashboard to add web resource on dashboard.



Step 3:  Open dashboard and click on the web resource button to select the 
            web resource button you added in step 1.




Step 4:  Select web resource in web resource look up which you created in
            step 1 and then save and publish



Enjoy the great technology Dynamics CRM. Good luck.....!!!!! 
Post a Comment