Dynamic Filtered Views in CRM2011
If you want to create a dynamic filterd lookup in crm2011 Ex:- If you have a account lookup & a contact lookup in a form & you want to filter & view the only contacts who's parentcustomer is equal to the selected account. You can use the following var defaultViewId; // FUNCTION: formOnLoad function formOnLoad() { var lookupFieldName = 'new_contactid'; var accountFieldName = 'new_accountid'; defaultViewId = Xrm.Page.getControl(accountFieldName).getDefaultView(); setLookup(accountFieldName, lookupFieldName, false); } // FUNCTION: setLookup function setLookup(accountFieldName, lookupFieldName, resetSelection) { // Get the selected Account Id in the [accountFieldName] indicated control var account = Xrm.Page.getAttribute(accountFieldName).getValue(); if (account != null) { var accountid = account[0].id; var accountname = account[0].name; if (resetSelection == true) { // ...