locked
Layout XML to not select any record when filtered view is set for Lookup. RRS feed

  • Question

  • Hi All,

    I have a requirement to filter lookup which I've done using addCustomView method which is working fine but when the view is loaded first record is selected by default, this looks it is that way by design but we have a requirement where no record should be selected when filtered view is loaded.

    Is there any we can tell it LayoutXml to render it that way. (May be Grid Property)

    Below is our FetchXml and LayoutXml:

    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
                        "<entity name='new_lob'>" +
                        "<attribute name='new_lobid' />" +
                        "<attribute name='new_name' />" +
                        "<attribute name='createdon' />" +
                        "<order attribute='new_name' descending='false' />" +
                        "<filter type='and'>" +
                        "<condition attribute='new_iscsc' operator='eq' value='1' />" +
                        "</filter>" +
                        "</entity>" +
                        "</fetch>";
    
        // build Grid Layout     
        var layoutXml = "<grid name='resultset' select='3' jump='new_name' icon='1' preview='2'>" +
                        //"object='1' " +
                        //"jump='new_lobid' " +
                        //"select='0' " +
                        //"icon='1' " +
                        //"preview='2'>" +
                        "<row name='result' " +
                        "id='new_lobid'>" +
                        "<cell name='new_name' " +
                        "width='200' />" +
                        "<cell name='new_slcode' " +
                        "width='200' />" +
                        "<cell name='new_iscsc' " +
                        "width='100' />" +
                        "<cell name='new_issr' " +
                        "width='100' />" +
                        "<cell name='new_isexpertsr' " +
                        "width='100' />" +
                        "<cell name='new_iscaravansr' " +
                        "width='100' />" +
                        "</row>" +
                        "</grid>";
        // add the Custom View to the primary contact lookup control      
        Xrm.Page.getControl("new_lobid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

    Thank You!

    Rahul.

    Wednesday, March 19, 2014 8:09 AM