2015-12-04 33 views
-2

如果「查找」下拉菜單中包含多個項目(例如,帳戶,聯繫人),可以將默認選項(在我的方案中設置爲第二個選項) )?默認查找視圖中的「查找」字段

+2

https://bingsoft.wordpress.com/2011/ 01/13/default-customer-lookup-to-contact-in-crm-2011/ –

+0

搜索「是否可以設置默認選項CRM查找」會產生許多結果,包括上述評論中添加的結果。請在提問前嘗試表明您已經做了一些調查。 – AdamV

+0

感謝您的幫助。我在用我認爲是錯誤的詞語進行搜索。 – MightyAtom

回答

-2
function Form_OnLoad() 
... 
preFilterLookup(); 
.. 
} 


function preFilterLookup() { 
Xrm.Page.getControl("customerid").addPreSearch(addLookupFilter); 
} 

function addLookupFilter() { 

document.getElementById("customerid_i").setAttribute  ("lookuptypenames", "contact:2:Contact"); 
document.getElementById("customerid_i").setAttribute("lookuptypes", "2"); 
} 

How do I change the default quick form for the CustomerId field in Dynamics CRM 2013?

+1

該代碼不適用於CRM 2015 SP1/2016。升級祝你好運。 –

+0

如果確實需要處理這個問題,你應該有一個OnChange js請求記錄類型,如果它不匹配清除查找的值。 – Sxntk

+0

@AndriiButenko公平,問題被標記爲2013年,所以這個答案應該在這種環境下工作。使用不支持的代碼在以後的版本中被棄用是不好的做法 –

0

在CRM 2015年,如果你要篩選的查找,你可以使用下面因此它僅包含聯繫人

// Filter the dropdown of the lookup so that it only contains contacts + do not allow accounts ,in the contact views, visible when the user clicks more records 
    var noAccountsfilter = "<filter type='and'><condition attribute='statecode' operator='ne' value='0' /></filter>"; 
    Xrm.Page.getControl("parentcustomerid").addCustomFilter(noAccountsfilter, 'account');