locked
CRM 2011: Advanced Find - Fetch XML (JavaScript) + Problems with the order of the list RRS feed

  • Question

  • Hi.

    I am using the following Fetch XML to make a custom advanced find with JavaScript. 

    The result is good but this is not ordering according the code  ("<order attribute='new_name' descending='false' />")

    I appreciate your suggestions.

    Thanks.

    var viewId = "{AABB37DF-A1F7-4810-A10C-04FE854B1E01}"; 
    
    var entityName = "new_metasplandetrabajo";
    var viewDisplayName = "CustomView";
    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' >" +                       
    				"<entity name='new_metasplandetrabajo'>" +
    			   "<attribute name='new_name' />" +
    			   "<attribute name='new_dimensiondelameta' />" +
    			   "<attribute name='new_tipodenivel' />" +    
    			   "<order attribute='new_name' descending='false' />" +                 
    			   "<filter type='and'>" +
    			   "<condition attribute='new_tipodenivel' operator='eq' value= '" + valorTipoNivel + "' />" +
    			   "<condition attribute='statecode' operator='eq' value='0' />" +
    			   "</filter>" +
    			   "</entity>" +
    			   "</fetch>";
    
    			   
    			   
    var layoutXml = "<grid name='resultset' " +
    			"object='10403' " +
    			"jump='new_tipodenivel'  " +
    			"select='1' " +
    			"icon='1' " +
    			"preview='1'>" +
    			"<row name='result' id='new_metasplandetrabajoid'>" +
    			"<cell name='new_name' width='300' />" +
    			"<cell name='new_dimensiondelameta' width='100' />" +
    			"<cell name='new_tipodenivel' width='100' />" +
    			"</row>" +
    		   "</grid>";
    
    Xrm.Page.getControl("new_metasid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
    

    Monday, April 7, 2014 1:39 PM

All replies

  • By default the code above order by createdon, but I was unable to change the sort (ascending or descending).

    Help!!!

    Monday, April 7, 2014 3:10 PM