How to disable view picker in filtered view CRM 2011 Javascript

5:16 AM

How to disable view picker in filtered view CRM 2011 Javascript
How to disable view picker in filtered view CRM 2011 Javascript
it annoying when you hava created filter view but still can pick up another view. these are simple step to disable view picker in filtered view dynamic CRM 2011 by javascript.

Step 1
create your own filter view


function filter_view()
{
 var viewid =  "{a76b2c46-c28e-4e5e-9ddf-951b71202c77}";//random

 var entityname = "new_entityname";
 var displayname = "Filter view";
 var fetchxml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
      "<entity name='new_entityname'>" +
       "<attribute name='new_name' />" +
       "<filter type='and'>" +
        "<condition attribute='statecode' operator='eq' value='0' />" +
       "</filter>" +
      "</entity>" +
     "</fetch>"; 
 
 var layoutxml = "<grid name='resultset' " +
      "object='1' " +
      "jump='name' " +
      "select='1' " +
      "icon='0' " +
      "preview='0'>" +
      "<row name='result' " +
       "id='new_entitynameid'>" +
       "<cell name='new_name' " +
        "width='200' />" +
      "</row>" +
     "</grid>";
     
 Xrm.Page.getControl("new_fieldname").addCustomView(viewid, entityname, displayname, fetchxml, layoutxml, true);

Step 2
just add a little bit code to disable view picker in the and of function


document.getElementById("xrm_segmentlevel2").setAttribute("disableViewPicker", "1");

Step 3
Done, and finish
thanks for visiting and enjong coding :)

You Might Also Like

0 comments